From ea2c4683e71da6c050430fd0ea122821902282e0 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 3 Jul 2026 17:55:46 -0700 Subject: Ark: 'Payment received!' celebration for Ark receives Same card and tap-to-acknowledge flow as on-chain receives; the ack persists in the ark state (shows exactly once) and a 2h recency guard keeps old payments from celebrating when a wallet is opened later. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QFAcD4V284DvYZZHP7Rxxy --- src/ark/manager.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/ark') diff --git a/src/ark/manager.js b/src/ark/manager.js index b2d01ce..1f21159 100644 --- a/src/ark/manager.js +++ b/src/ark/manager.js @@ -122,6 +122,20 @@ export class ArkManager { const sum = (st) => this.state.vtxos.filter((v) => v.state === st).reduce((n, v) => n + v.amountSat, 0); return { spendableSat: sum('spendable'), pendingSat: sum('pending') }; } + + // Receives newer than the last acknowledgement — the UI's "Payment + // received!" celebration. Recency-guarded like the on-chain equivalent so an + // old payment never celebrates when a wallet is opened much later. + unseenReceives() { + const ack = this.state.receiveAckTs || 0; + const cutoff = Date.now() - 2 * 3600 * 1000; + return this.state.movements.filter((m) => + m.type === 'receive' && m.status === 'complete' && m.ts > ack && m.ts > cutoff); + } + ackReceives() { + this.state.receiveAckTs = Date.now(); + this._save(); + } vtxos() { return this.state.vtxos.slice(); } movements() { return this.state.movements.slice(); } pendingActions() { return this.state.actions.filter((a) => !['done', 'failed'].includes(a.step)); } -- cgit v1.2.3