From 374f08e28a1bb42fb8911d34126043b69f286410 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 28 Jun 2026 18:10:56 -0700 Subject: Fix Add wallet reusing the current wallet's seed instead of a new one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The create pane shows the existing draftMnemonic's backup if one is set, only falling back to the Generate-seed step when it's empty. Nothing cleared the draft after a wallet was created, and Add wallet jumped to the create tab without resetting it — so Add wallet presented the already-active wallet's seed, and 'creating' it just re-opened the same account (no new wallet). Clear draftMnemonic (+ createStep, confirm) when Add wallet starts a fresh creation, and clear it in openWallet once a seed has been used to create/enter a wallet, so each new creation generates a fresh seed. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app.js b/src/app.js index a11691c..cd63fe9 100644 --- a/src/app.js +++ b/src/app.js @@ -731,7 +731,7 @@ async function openWallet(input, opts = {}) { ui.unlockError = ''; const raw = (input || '').trim(); const m = raw.replace(/\s+/g, ' '); - if (isValidMnemonic(m)) { await enterWallet(m, ui.passphrase, { generated: opts.generated }); return; } + if (isValidMnemonic(m)) { await enterWallet(m, ui.passphrase, { generated: opts.generated }); ui.draftMnemonic = ''; return; } // discard the used draft so the next "Add wallet" generates a fresh seed let pk; try { pk = parseExtendedKey(raw); } catch { ui.unlockError = t('invalidImport'); render(); return; } const acc = pk.kind === 'xpub' @@ -2278,7 +2278,7 @@ function accountsScreen() { ); }) ), - h('button', { class: 'btn-block', onClick: () => { ui.screen = 'unlock'; ui.unlockTab = 'create'; ui.fromWallet = true; ui.unlockError = ''; render(); } }, t('addWallet')), + h('button', { class: 'btn-block', onClick: () => { ui.draftMnemonic = ''; ui.createStep = 'gen'; ui.confirm = []; ui.screen = 'unlock'; ui.unlockTab = 'create'; ui.fromWallet = true; ui.unlockError = ''; render(); } }, t('addWallet')), hasVault() ? h('button', { class: 'btn-ghost btn-block', onClick: startChangePw }, t('changePassword')) : null, h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.confirmClear = true; render(); } }, t('clearAll')) ), -- cgit v1.2.3