Swap XMR and XRP through kyc.rip without leaving the app
This commit is contained in:
@@ -34,6 +34,9 @@ enum SelfTest {
|
||||
if ProcessInfo.processInfo.arguments.contains("-koinsSelfTestNetwork") {
|
||||
runNetwork()
|
||||
}
|
||||
if ProcessInfo.processInfo.arguments.contains("-koinsSelfTestSwap") {
|
||||
runSwapCheckIfRequested()
|
||||
}
|
||||
}
|
||||
|
||||
/// End-to-end check of the live network paths (XRP RPC + native Monero
|
||||
@@ -113,6 +116,23 @@ enum SelfTest {
|
||||
}
|
||||
}
|
||||
|
||||
/// Temporary: exercise the kyc.rip estimate path with real values.
|
||||
static func runSwapCheckIfRequested() {
|
||||
guard ProcessInfo.processInfo.arguments.contains("-koinsSelfTestSwap") else { return }
|
||||
Task.detached {
|
||||
do {
|
||||
let estimate = try await SwapService.shared.estimate(from: "xmr", to: "xrp", amount: 1)
|
||||
emit("KOINS_SWAP amountTo \(estimate.amountTo)")
|
||||
for route in estimate.routes.prefix(3) {
|
||||
emit("KOINS_SWAP route \(route.provider) (\(route.engine)) -> \(route.amountTo) eta \(route.eta ?? -1)")
|
||||
}
|
||||
} catch {
|
||||
emit("KOINS_SWAP FAIL \(error)")
|
||||
}
|
||||
flushReport()
|
||||
}
|
||||
}
|
||||
|
||||
static func run() {
|
||||
var failures = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user