aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/ark.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-22 11:06:40 -0700
committerAdam Soltys <[email protected]>2026-09-22 11:06:40 -0700
commita74953eefc590f17575b1fa79511bd3255d20603 (patch)
tree38c20c58174ef509b31a79e3b46d78417b9f9561 /src/features/ark.js
parent7a1795f4205d3eec7f7446c341fd1278c90ed441 (diff)
downloadcoinosv3-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
Diffstat (limited to 'src/features/ark.js')
-rw-r--r--src/features/ark.js18
1 files changed, 18 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()) {