From 5848cc44129a7ce4450e6bedaf40682f7f3ca4d4 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 28 Aug 2026 12:49:14 -0700 Subject: A claimed gift shows you the pocket it landed in: an ark gift claim latches the Spending side and selects it on every path into the wallet — backup, verify, skip, or straight in — instead of opening onto an empty Savings face MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi --- src/features/gifts.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/features') diff --git a/src/features/gifts.js b/src/features/gifts.js index 9c4e0eb..3b094d1 100644 --- a/src/features/gifts.js +++ b/src/features/gifts.js @@ -214,7 +214,7 @@ export function giftsFeature(ctx) { ), h('div', { class: 'row gap6' }, copyBtn(wallet.mnemonic, t('copyPhrase'))), h('button', { class: 'btn-primary btn-block', onClick: () => { ui.confirm = pickConfirm(words); ui.claimError = ''; ui.claimStep = 'verify'; render(); } }, t('verifyBackup')), - h('button', { class: 'btn-block', onClick: () => { ui.screen = 'wallet'; ui.claimStep = null; render(); } }, t('skipVerification')) + h('button', { class: 'btn-block', onClick: () => { ui.screen = 'wallet'; ui.claimStep = null; landAccount(); render(); } }, t('skipVerification')) ) ); } @@ -247,11 +247,12 @@ export function giftsFeature(ctx) { const ok = ui.confirm.every((c) => c.value.toLowerCase() === words[c.index]); if (!ok) { ui.claimError = t('wordsMismatch'); render(); return; } ui.screen = 'wallet'; ui.claimStep = null; ui.claimError = ''; + landAccount(); render(); }, }, t('openWallet')) ), - h('button', { class: 'btn-block', onClick: () => { ui.screen = 'wallet'; ui.claimStep = null; render(); } }, t('skipVerification')) + h('button', { class: 'btn-block', onClick: () => { ui.screen = 'wallet'; ui.claimStep = null; landAccount(); render(); } }, t('skipVerification')) ) ); } @@ -286,7 +287,7 @@ export function giftsFeature(ctx) { h('button', { class: 'btn-primary btn-block', onClick: () => { ui.claimTaken = null; ui.claimedAmount = 0; if (activeAccount() && activeAccount().provisional) { ui.claimStep = 'backup'; commitAccount(); } - else { ui.screen = 'wallet'; ui.claimStep = null; } + else { ui.screen = 'wallet'; ui.claimStep = null; landAccount(); } render(); } }, activeAccount() && activeAccount().provisional ? t('createWalletAnyway') : t('goToWallet')), ui.claimTaken.txid @@ -377,6 +378,15 @@ export function giftsFeature(ctx) { // Broadcast the presigned gift to this fresh wallet's first receive address. // Shared post-claim navigation: fresh wallets go to seed backup, existing // ones straight in with the instant celebration. + // An ark gift lands in Spending — say so with the selection, or the new + // owner opens onto an empty Savings face wondering where the sats went. + function landAccount() { + if (ui.claimVia !== 'ark') return; + const acc = activeAccount(); + if (acc && !acc.spendingSetup) acc.spendingSetup = Date.now(); + if (ctx.setAccount) ctx.setAccount('spending'); + } + function afterClaim(amount) { ui.claimedAmount = amount; const wasProvisional = !!(activeAccount() && activeAccount().provisional); @@ -388,6 +398,7 @@ export function giftsFeature(ctx) { ui.claimStep = null; ui.tab = 'receive'; ui.giftJustClaimed = amount; // celebration shows instantly, no scan wait + landAccount(); } return wasProvisional; } @@ -404,6 +415,7 @@ export function giftsFeature(ctx) { // off-chain, instant, no fee, works for a brand-new empty wallet. try { const amount = await hook('arkGiftClaim', ui.claimCode); + ui.claimVia = 'ark'; afterClaim(amount); } catch (e) { if (e && e.giftTaken) ui.claimTaken = {}; -- cgit v1.2.3