From 274130edd7d11a0643d9b1f7469022207e5f5563 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 28 Aug 2026 07:57:09 -0700 Subject: The wallet remembers it has a spending side: the relay backup carries the hint, stamped the moment spending becomes real, so a restore paints Spending from its first frame instead of reflowing when the name lookup catches up — and the sign-in toasts are gone, since a wallet appearing announces itself 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/app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/app.js') diff --git a/src/app.js b/src/app.js index 9435cc3..5b5c3d5 100644 --- a/src/app.js +++ b/src/app.js @@ -1111,6 +1111,10 @@ async function activateAccount(acc, opts = {}) { // current global choice once, then keep it. The global setting remains the // default for the NEXT new wallet. if (!acc.network) acc.network = getNetwork(); + // The relay backup said this wallet has a Spending side: latch it BEFORE + // the first paint, so a restored wallet doesn't open as savings-only and + // reflow when the name lookup proves Spending a beat later. + if (opts.spendingHint && !acc.spendingSetup) { acc.spendingSetup = Date.now(); } const netName = acc.network; if (netName !== getNetwork()) { setNetwork(netName); @@ -2954,7 +2958,7 @@ function onboardScreen() { const spendReady = claimedNow || (featureHook('spendingSat') || 0) > 0 || (getNetwork() === 'mainnet' && named); if (spendReady) { - if (acc && !acc.spendingSetup) { acc.spendingSetup = Date.now(); persistAccounts(); } + if (acc && !acc.spendingSetup) { acc.spendingSetup = Date.now(); persistAccounts(); featureHook('spendingEvident'); } ui.account = 'spending'; try { localStorage.setItem(ACCOUNT_KEY, 'spending'); } catch {} } @@ -3095,7 +3099,7 @@ function spendingActive() { const evident = (featureHook('spendingSat') || 0) > 0 || (!!addr && !/^npub1/.test(addr)); // Latch demonstrated use onto the record, so the Wallets list keeps showing // this seed's Spending side even while it's locked or not the active one. - if (evident && acc && !acc.spendingSetup) { acc.spendingSetup = Date.now(); persistAccounts(); } + if (evident && acc && !acc.spendingSetup) { acc.spendingSetup = Date.now(); persistAccounts(); featureHook('spendingEvident'); } return evident; } // ---- the flat wallet model ------------------------------------------------- @@ -3239,6 +3243,7 @@ function balanceCard() { ? h('button', { class: 'btn-sm', style: 'margin-top:10px', onClick: () => { acc0.spendingSetup = Date.now(); persistAccounts(); + featureHook('spendingEvident'); setAccountSel('spending', 'right'); ui.onbError = ''; ui.onb = { step: 'spend' }; -- cgit v1.2.3