diff options
| author | Adam Soltys <[email protected]> | 2026-09-21 12:37:15 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-21 12:37:15 -0700 |
| commit | f9bd28e2a03aa0874ea0416dfac9293bec4c4456 (patch) | |
| tree | 20837205743f54af6b51784d5f33d891714356cd | |
| parent | ceb3d142c36d9db1f3346f4aa7979f6732ba5d88 (diff) | |
| download | coinosv3-f9bd28e2a03aa0874ea0416dfac9293bec4c4456.tar.gz coinosv3-f9bd28e2a03aa0874ea0416dfac9293bec4c4456.zip | |
First run: a new wallet is offered a Spending account before the home screen, Not now one tap away.
The wizard's spend step (claim a name, get a payment address) now follows
the seed screen and the sign-in backup screen, wherever Spending can be
set up (Ark-capable network with the names registrar, a signing account).
Not now lands on Savings like before. namesAvailable answers 'yes'/'no'
rather than a boolean, which featureHook would read as no answer.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp
| -rw-r--r-- | src/app.js | 23 | ||||
| -rw-r--r-- | src/features/names.js | 3 |
2 files changed, 24 insertions, 2 deletions
@@ -3232,6 +3232,15 @@ async function onbUpload(file) { return url; } +// Whether the wizard can offer Spending at all: an Ark-capable build on a +// network with the names registrar, for a full (signing) account. Elsewhere +// the offer would be a spinner that never resolves. +function canOfferSpending() { + const acc = activeAccount(); + if (!acc || acc.type !== 'full' || wallet.watchOnly) return false; + if (!featureHook('arkReady')) return false; + return featureHook('namesAvailable') === 'yes'; +} function onboardScreen() { if (!ui.onb) { let saved = null; @@ -3261,7 +3270,11 @@ function onboardScreen() { // Handled further down, where page()/title() exist. const arrived = activeAccount(); if (arrived && arrived.mnemonic && !arrived.seedSeen) o.step = 'backup'; - else { + else if (canOfferSpending()) { + // Before the home screen: one offer to set up Spending (a name and a + // payment address), with Not now a single tap away. + o.step = 'spend'; o.enterAddr = undefined; + } else { ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} // On-chain first: the wizard's promise is "your keys, your coins", and @@ -3383,6 +3396,7 @@ function onboardScreen() { const words = acc.mnemonic.split(' '); const done = () => { markSeedSeen(acc); + if (canOfferSpending()) { o.step = 'spend'; o.enterAddr = undefined; render(); return; } ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} ui.account = 'savings'; @@ -3401,6 +3415,7 @@ function onboardScreen() { // Later means later, not never: seedSeen stays false, so the wallet // keeps a quiet reminder until the phrase has actually been seen. h('button', { class: 'btn-ghost btn-block', onClick: () => { + if (canOfferSpending()) { o.step = 'spend'; o.enterAddr = undefined; render(); return; } ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} ui.account = 'savings'; @@ -3434,10 +3449,14 @@ function onboardScreen() { title(t('onbSpendTitle')), h('p', { class: 'muted', style: 'margin:0' }, t('onbSpendBody')), featureHook('namesClaimForm') || h('div', { class: 'row gap6', style: 'align-items:center' }, h('span', { class: 'spinner sm' }), h('span', { class: 'small muted' }, t('onbNameWait'))), - // Optional means optional: one tap back to the wallet, no questions. + // Optional means optional: one tap to the wallet, no questions — on + // Savings, the account that exists without any setup. h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} + ui.account = 'savings'; + try { localStorage.setItem(ACCOUNT_KEY, 'savings'); } catch {} + ui.tab = 'history'; render(); } }, t('onbNotNow')), ]); diff --git a/src/features/names.js b/src/features/names.js index f05ac09..dd6f700 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -895,6 +895,9 @@ export function namesFeature(ctx) { // 'pending' while the restore/claim pass is still running — the wallet // screen holds spending-setup prompts until the name question is settled. namesSettled() { return checked ? 'yes' : 'pending'; }, + // the wizard offers Spending only where a name can be claimed — a word, + // not a boolean: featureHook reads a false answer as no answer at all + namesAvailable() { return available() ? 'yes' : 'no'; }, // A seed minted seconds ago has nothing to restore anywhere: don't make // the spending-setup ask wait out registrar round trips that only exist // for wallets with a history. The background claim still runs. |
