aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/ark.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-28 12:47:07 -0700
committerAdam Soltys <[email protected]>2026-08-28 12:47:07 -0700
commit97be87fcea0bc24f553e8a9814de7a2825624cec (patch)
treecd12cb1d86bd5ee509bc0af94af42c4f9eee1027 /src/features/ark.js
parentfe48e973786dabff477c59d55a8dd4b291a1b555 (diff)
downloadcoinosv3-97be87fcea0bc24f553e8a9814de7a2825624cec.tar.gz
coinosv3-97be87fcea0bc24f553e8a9814de7a2825624cec.zip
A send can't quietly change accounts: pasting an on-chain address in Spending while every coin is mid-exit now opens the exit's own status page — before, it fell through to the Savings send form, whose fee-trimmed Max read as the spending balance shrinking by half
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi
Diffstat (limited to 'src/features/ark.js')
-rw-r--r--src/features/ark.js25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index 2695183..e98ecc3 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -2294,12 +2294,25 @@ export function arkFeature(ctx) {
const inv = (text || '').trim().replace(/^lightning:/i, '');
// 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() && (arkBalance()?.spendableSat || 0) > 0) {
- ui.arkOffboardSend = { address: inv, amount: '' };
- ui.sendError = '';
- render();
- return true;
+ if (ctx.getAccount() === 'spending' && wallet.isOnchainAddress(inv) && arkAvailable()) {
+ const b = arkBalance() || {};
+ if ((b.spendableSat || 0) > 0) {
+ ui.arkOffboardSend = { address: inv, amount: '' };
+ ui.sendError = '';
+ render();
+ return true;
+ }
+ // Every coin is mid-exit: the balance face still shows the pending
+ // sats, so falling through to the SAVINGS send form here read as the
+ // spending send silently swapping accounts (fee-adjusted Max and
+ // all). Show the exit's status instead — that's where the money is.
+ if ((b.pendingSat || 0) > 0
+ && (arkStateNow()?.actions || []).some((a) => a.type === 'exit' && !['done', 'failed'].includes(a.step))) {
+ ui.arkExitPage = true;
+ ui.sendError = '';
+ render();
+ return true;
+ }
}
if (maybeBolt11(inv)) return startArkLnPay(inv);
const pk = npubToHex(text);