Swap XMR and XRP through kyc.rip without leaving the app

This commit is contained in:
2026-10-07 21:01:34 +08:00
parent 31429e6923
commit 4fa1584dfc
6 changed files with 631 additions and 0 deletions
+20
View File
@@ -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