From a74953eefc590f17575b1fa79511bd3255d20603 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 22 Sep 2026 11:06:40 -0700 Subject: Send: a bitcoin: URI with ark= pays over Ark on the same server, on-chain with a note otherwise. Noah and Second's other wallets share BIP-21 URIs carrying an ark= address. Same server as ours: the send goes over Ark with the URI's amount (your own address routes to boarding). A different server: the on-chain address is used and a toast says why. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp --- src/features/ark.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/features') diff --git a/src/features/ark.js b/src/features/ark.js index 79895be..2b81a1e 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -3495,6 +3495,24 @@ export function arkFeature(ctx) { if (foreignArkAddr(inv)) { ui.sendError = t('arkForeignServer'); render(); return true; } boardOwnAddress(inv, { connect: true }).catch(() => {}); } + // A BIP-21 URI with an ark= instruction (Noah, Second's wallets, our + // own names): same server → pay over Ark, instant and free, with the + // URI's amount; another server → the on-chain address, and say why. + if (/^bitcoin:/i.test(inv) && arkAvailable() && !wallet.watchOnly) { + const dec = parseBip21Uri(inv); + const arkAddr = dec && dec.params && dec.params.ark; + if (arkAddr && isArkAddress(arkAddr)) { + if (foreignArkAddr(arkAddr)) { toast(t('arkForeignBip21'), 4000); return false; } + boardOwnAddress(arkAddr, { connect: true }).catch(() => {}); + const s = ui.send; + s.recipients[0].address = arkAddr; + const btc = Number(dec.params.amount); + if (btc > 0) { s.recipients[0].amount = amountFill(Math.round(btc * 1e8)); s.max = false; } + ui.sendError = ''; + render(); + return true; + } + } // In a Spending wallet an on-chain address means "exit ark to there": // the offboard happens right in the send flow, no Move money ceremony. if (ctx.getAccount() === 'spending' && wallet.isOnchainAddress(inv) && arkAvailable()) { -- cgit v1.2.3