diff options
| author | Adam Soltys <[email protected]> | 2026-09-22 11:06:40 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-22 11:06:40 -0700 |
| commit | a74953eefc590f17575b1fa79511bd3255d20603 (patch) | |
| tree | 38c20c58174ef509b31a79e3b46d78417b9f9561 | |
| parent | 7a1795f4205d3eec7f7446c341fd1278c90ed441 (diff) | |
| download | coinosv3-a74953eefc590f17575b1fa79511bd3255d20603.tar.gz coinosv3-a74953eefc590f17575b1fa79511bd3255d20603.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp
| -rw-r--r-- | src/features/ark.js | 18 | ||||
| -rw-r--r-- | src/i18n.js | 1 |
2 files changed, 19 insertions, 0 deletions
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()) { diff --git a/src/i18n.js b/src/i18n.js index ff67fc1..74219ac 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -860,6 +860,7 @@ const STR = { arkCmpMin: 'min {n} sats', arkCmpNote: 'Fees graded by expiry cost more the earlier a coin is renewed or exited. Figures come from each server’s own published info, read just now. Either server pays Lightning invoices and takes Lightning payments to your coinos name.', arkServerSwitched: 'Ark server switched', + arkForeignBip21: 'Their Ark address is on a different Ark server — paying the on-chain address instead.', arkForeignServer: 'That Ark address belongs to a different Ark server, so it can’t be paid from here directly. Ask for a Lightning invoice, or pay their coinos name or npub — those fall back to Lightning by themselves.', arkLnFromSavingsTitle: 'Lightning pays from Spending', arkLnFromSavingsBody: 'Lightning payments leave your Spending balance, not Savings. Spending holds {have}.', |
