From e74b576c8641627a700ffa82fd7179b8cf84993d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 6 Jul 2026 10:18:52 -0700 Subject: Show ark balance for watch-only wallets (read from persisted state) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a refresh a wallet reverts to watch-only unless the seed was saved to device — and ark balance/history were gated behind arkAvailable() (which excludes watch-only), so the on-chain balance showed but the ark balance vanished. The ark state is persisted locally and should display read-only exactly like the on-chain balance. arkStateNow() now reads it whenever Ark is configured for the network, regardless of watch-only; the Exit link (which needs keys to act) is hidden for watch-only. Verified: full wallet shows balance + Exit link, a locked/watch-only wallet shows the balance alone. Co-Authored-By: Claude Fable 5 --- src/features/ark.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/features/ark.js') diff --git a/src/features/ark.js b/src/features/ark.js index 36aecf2..ba509aa 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -204,7 +204,11 @@ export function arkFeature(ctx) { // flickering (empty → populated) while the manager connects asynchronously. function arkStateNow() { if (ark && ark.state) return ark.state; - if (!arkAvailable()) return null; + // Read persisted state whenever Ark is configured for this network — even + // watch-only (seed not loaded this session): the balance/history should + // show read-only, just like the on-chain balance does. Acting on it + // (send/exit) still requires the seed and is gated separately. + if (!getArkConfig()) return null; return wallet.loadArkState(); } @@ -1094,9 +1098,12 @@ export function arkFeature(ctx) { const lines = []; if (b.spendableSat + b.pendingSat > 0) { // "Ark balance … Exit" — the exit link opens the offboard/exit page. - const label = h('span', { class: 'row gap6', style: 'align-items:center' }, - t('arkBalance'), - h('span', { class: 'linklike', style: 'font-size:12px', onClick: () => { ui.arkExitPage = true; ui.arkError = ''; render(); } }, t('arkExitLink'))); + // Watch-only wallets can't move funds, so they just show the balance. + const label = wallet.watchOnly + ? t('arkBalance') + : h('span', { class: 'row gap6', style: 'align-items:center' }, + t('arkBalance'), + h('span', { class: 'linklike', style: 'font-size:12px', onClick: () => { ui.arkExitPage = true; ui.arkError = ''; render(); } }, t('arkExitLink'))); lines.push({ label, sat: b.spendableSat + b.pendingSat }); } // A board in flight: the sats already left the on-chain balance, so show -- cgit v1.2.3