From 7c542410dc78711bcf017dd3d23d560ed6349669 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 22 Jun 2026 21:47:09 -0700 Subject: Fix false "payment received" on import; PWA; send-page font MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Don't celebrate historical payments on import. receiveSeenIndex was baselined to 0 before the scan ran, so when the scan advanced the index every past payment looked new and flashed "payment received". Leave it null until the post-scan ack logic baselines it. - PWA: add a web manifest, ₿ icons (192/512 + maskable), theme/apple meta tags, and a service worker that precaches the shell so the installed app works offline. index.html stays self-contained; the sidecar files just 404 harmlessly from file://. build.js emits them. - Send page: drop btn-sm from the amount unit toggle so "sats" matches the "Max" button size (both 16px). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/app.js b/src/app.js index bccb86d..8343290 100644 --- a/src/app.js +++ b/src/app.js @@ -466,6 +466,10 @@ async function enterWallet(mnemonic, passphrase) { const hadCache = wallet.restoreCache(); // show last-known balance/history instantly ui.screen = 'wallet'; ui.tab = 'receive'; + // Not baselined yet — stays null until the scan + ack logic below sets it, + // so the celebration never fires for payments that were already there at + // import (the index only looks "advanced" because the scan hadn't run yet). + ui.receiveSeenIndex = null; ui.send = blankSend(); ui.draft = null; ui.sendResult = null; @@ -760,11 +764,12 @@ function tabContent() { // ---------------------------------------------------------------- Receive function receiveTab() { - if (ui.receiveSeenIndex == null) ui.receiveSeenIndex = wallet.nextReceiveIndex; - // A payment landed on the shown address (the fresh index advanced past what // the user last saw) — celebrate, and wait for a tap before showing the next. - if (wallet.nextReceiveIndex > ui.receiveSeenIndex) { + // Until receiveSeenIndex has been baselined (post-scan, in enterWallet) it + // stays null and we never celebrate, so importing a wallet with existing + // history doesn't flash "payment received" for old payments. + if (ui.receiveSeenIndex != null && wallet.nextReceiveIndex > ui.receiveSeenIndex) { let amt = 0; for (let i = ui.receiveSeenIndex; i < wallet.nextReceiveIndex; i++) { const e = wallet._addrInfo(0, i); @@ -837,7 +842,7 @@ function recipientRow(s, r, i) { r.amount = v; }, }), - h('button', { type: 'button', class: 'btn-sm', title: t('switchUnit'), onClick: toggleUnit }, unitLabel()), + h('button', { type: 'button', title: t('switchUnit'), onClick: toggleUnit }, unitLabel()), single && h('button', { type: 'button', class: s.max ? 'btn-primary' : '', onClick: () => { s.max = !s.max; render(); } }, t('max')) ) ); -- cgit v1.2.3