aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app.js37
-rw-r--r--tools/ark/gift-shot.js7
2 files changed, 42 insertions, 2 deletions
diff --git a/src/app.js b/src/app.js
index cbac144..0c15304 100644
--- a/src/app.js
+++ b/src/app.js
@@ -2246,9 +2246,19 @@ async function doClaim() {
} else {
ui.screen = 'wallet'; // existing wallet — straight into it, no new seed to back up
ui.claimStep = null;
- toast(t('giftClaimedToast'));
+ ui.tab = 'receive';
+ ui.giftJustClaimed = claim.amount; // celebration shows instantly, no scan wait
}
- wallet.scan().catch(() => {});
+ wallet.scan().then(() => {
+ // The claim credit advances the fresh receive index in the background;
+ // ack it so the index-based celebration doesn't fire a second time
+ // behind the instant one we're already showing.
+ if (ui.giftJustClaimed != null) {
+ ui.receiveSeenIndex = wallet.nextReceiveIndex;
+ wallet.setReceiveAck(wallet.nextReceiveIndex);
+ render();
+ }
+ }).catch(() => {});
} catch (e) {
// Broadcast failed — most likely someone claimed it in the race window.
// Re-check the funding coin and, if spent, show the "already claimed" screen.
@@ -2810,6 +2820,29 @@ function hasRecentIncoming() {
// ---------------------------------------------------------------- Receive
function receiveTab() {
+ // A gift was just claimed into this wallet — celebrate immediately (the
+ // background scan credits the coin and advances the address meanwhile).
+ if (ui.giftJustClaimed != null) {
+ const amt = ui.giftJustClaimed;
+ return h(
+ 'div',
+ {
+ class: 'card col',
+ style: 'align-items:center;text-align:center;gap:14px;cursor:pointer;padding:48px 20px',
+ onClick: () => {
+ ui.giftJustClaimed = null;
+ ui.receiveSeenIndex = wallet.nextReceiveIndex;
+ wallet.setReceiveAck(wallet.nextReceiveIndex);
+ render();
+ },
+ },
+ h('div', { class: 'check-badge' }, '✓'),
+ h('h2', { style: 'margin:0' }, t('paymentReceived')),
+ amt ? h('div', { class: 'amount-pos', style: 'font-size:18px' }, '+' + fmtAmount(amt) + ' ' + unitLabel()) : null,
+ h('div', { class: 'small muted' }, t('tapToProceed'))
+ );
+ }
+
// A board just broadcast — show its success screen until dismissed.
if (ui.arkBoarded) {
const b = ui.arkBoarded;
diff --git a/tools/ark/gift-shot.js b/tools/ark/gift-shot.js
index b4bf2d1..b0c9ca5 100644
--- a/tools/ark/gift-shot.js
+++ b/tools/ark/gift-shot.js
@@ -83,6 +83,13 @@ await waitText('Claim it', 15000);
await sleep(400);
await page.screenshot({ path: '/tmp/gift-claim-existing.png' });
console.log('claim copy:', await page.evaluate(() => [...document.querySelectorAll('p')].map((e) => e.textContent).find((x) => x.includes('Claim it'))));
+
+// claim it — the celebration should be instant (no scan wait)
+await clickText('button', 'Claim it');
+const t0 = Date.now();
+const celebrated = await waitText('Payment received', 10000);
+console.log('celebration:', celebrated, 'after', Date.now() - t0, 'ms');
+await page.screenshot({ path: '/tmp/gift-claimed.png' });
console.log('done');
await browser.close();
dev.kill();