From 6d649f9bdd0582520e23dff4b5a967f0a125857e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 30 Jun 2026 09:29:46 -0700 Subject: Swaps: reuse the generic 'Payment received' screen for LN receives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A reverse-swap claim is an on-chain receive, so instead of a separate LN 'Received!' card (which stacked with the generic celebration and needed suppression), credit the claimed coin to the wallet the instant we broadcast the claim — new wallet.creditReceive() mirrors the instant-payment watcher path (adds the utxo + pending row, advances the receive index, emits). The generic 'Payment received!' then fires immediately with the right amount, one screen, one tap. Dropped the LN success card + the suppression logic. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/app.js') diff --git a/src/app.js b/src/app.js index f43fe1c..008765e 100644 --- a/src/app.js +++ b/src/app.js @@ -2602,11 +2602,7 @@ function receiveTab() { // Until receiveSeenIndex has been baselined (post-scan, in enterWallet) it // stays null and we never celebrate. The recency guard additionally ensures an // already-old payment never celebrates when a wallet is opened. - // While the Lightning "Received!" card is up (a reverse-swap claim is also an - // on-chain receive that advances the index), suppress this generic celebration - // so the two don't stack — its Done dismisses both. - const lnClaimShown = !!(ui.lnReceiveId && (() => { const r = swaps.list().find((s) => s.id === ui.lnReceiveId); return r && ['claimed', 'success'].includes(r.status); })()); - if (!lnClaimShown && ui.receiveSeenIndex != null && wallet.nextReceiveIndex > ui.receiveSeenIndex && hasRecentIncoming()) { + if (ui.receiveSeenIndex != null && wallet.nextReceiveIndex > ui.receiveSeenIndex && hasRecentIncoming()) { // Mark it acknowledged as soon as it's shown — so a refresh or navigating // away (without tapping) won't bring the celebration back. It stays visible // this session (ui.receiveSeenIndex is unchanged) until the tap below. @@ -2670,14 +2666,13 @@ function lnReceiveContent() { swaps.reverseLimits().then((l) => { ui.swapLimits = l; ui._swapLimitsLoading = false; render(); }).catch(() => { ui._swapLimitsLoading = false; }); } const lim = ui.swapLimits; - const rec = ui.lnReceiveId ? swaps.list().find((s) => s.id === ui.lnReceiveId) : null; + let rec = ui.lnReceiveId ? swaps.list().find((s) => s.id === ui.lnReceiveId) : null; if (rec && ['claimed', 'success'].includes(rec.status)) { - return [ - h('div', { class: 'check-badge' }, '✓'), - h('h3', { style: 'margin:0' }, t('lnReceived')), - rec.received ? h('div', { class: 'amount-pos', style: 'font-size:18px' }, '+' + fmtAmount(rec.received) + ' ' + unitLabel()) : null, - h('button', { class: 'btn-block', onClick: () => { ui.lnReceiveId = null; ui.swapReverseAmt = ''; ui.receiveSeenIndex = wallet.nextReceiveIndex; wallet.setReceiveAck(wallet.nextReceiveIndex); render(); } }, t('done')), - ]; + // Claimed — the coin is credited on-chain (swap.js → creditReceive), so the + // generic "Payment received!" celebration shows it like any receive. Just + // reset the Lightning flow back to its form. + ui.lnReceiveId = null; + rec = null; } if (rec) { let svg = null; -- cgit v1.2.3