Skip to content

feat(wallet): tick the balance up when a scanned bill is claimed - #1369

Open
bmc08gt wants to merge 1 commit into
code/cashfrom
feat/wallet-claim-reveal
Open

feat(wallet): tick the balance up when a scanned bill is claimed#1369
bmc08gt wants to merge 1 commit into
code/cashfrom
feat/wallet-claim-reveal

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Put in Wallet dismissed the bill and left the user on the scanner. The money they had just taken only showed up the next time they opened the wallet, already counted.

The button now takes them to the wallet tab and the balance rolls up on arrival.

Why there's a coordinator for this

The roll needs a "before" to start from, and there isn't one by the time the wallet opens. tokenCoordinator.add credits the account when the bill is grabbed, several taps before the claim, so every flow the wallet reads has already moved.

WalletRevealCoordinator carries the pre-credit picture across that gap:

  1. CodeScanDelegate captures the totals immediately before the credit.
  2. claimReceivedFunds() arms the snapshot and dismisses the bill. It's a separate BillOperations method rather than a branch inside dismissBill(PutInWallet), because that same result also covers a grab timeout, a cancel, and a swipe-away, none of which is the user asking to see their wallet.
  3. The wallet opens on the snapshot, holds it for 450ms, then releases to live values.

The header and each card's balance already draw through AnimatedNumberText, so the roll itself is just the rendered string changing. The claimed token's own card balance is held back too, so its number rolls in step with the total above it instead of sitting there already updated.

The hold is timed from the wallet reporting itself drawn, not from the tap, so a slow tab doesn't spend the window behind the loading spinner. A reveal nobody collects releases itself after 3s, which also means there's no logout or reset wiring to keep in sync.

Only scanned bills route

A cash link is claimed from a link rather than from the scanner, so nothing is captured for it. arm() returns whether there was a snapshot, claimReceivedFunds() passes that back, and the decorator navigates only on true. The cash link confirmation dismisses where it stands, as it did before.

New card entry

A claim in a currency the wallet didn't hold is withheld from the deck for the same beat, then passed to TokenCardStack as enteringMint. The deck opens a slot from 0 to the full fanned reveal and the card fades in over the first half of that.

The caller names the entering card rather than the stack diffing its own token list. The case that most needs the animation, a wallet that held nothing so the stack was never composed, is exactly the one a diff can't see. The entry offset is read in the placement phase alongside scrolledPast, so it only re-places cards, and the measured height stays the full fanned height so the list's scroll range doesn't move.

Tests

WalletRevealCoordinatorTest covers the capture/arm/hold/release cycle: a capture is consumed once so a second tap can't replay it, arming with nothing captured publishes nothing and reports false, a redraw part way through the hold doesn't extend it, and an uncollected reveal times out. CodeScanDelegateTest asserts the ordering the whole thing rests on, that the snapshot is taken before the credit. BillPresentationDelegateTest covers both claim paths and checks the other PutInWallet dismissals leave the reveal alone.

@bmc08gt bmc08gt self-assigned this Aug 28, 2026
"Put in Wallet" dismissed the bill and left the user on the scanner, so money
they had just taken only showed up the next time they opened the wallet,
already counted.

The button now hands them to the wallet tab and the balance rolls up on
arrival. That roll needs a "before" to start from, and there isn't one by
then: `tokenCoordinator.add` credits the account when the bill is *grabbed*,
several taps earlier, so every flow the wallet reads has already moved.
`WalletRevealCoordinator` captures the pre-credit totals at the grab,
`claimReceivedFunds` arms them, and the wallet opens on that snapshot for
450ms before releasing to live values. Both the header and each card's balance
already draw through `AnimatedNumberText`, so the roll is just the rendered
string changing.

Only a scanned bill routes. A cash link is claimed from a link rather than
from the scanner, so nothing is captured for it, `arm()` reports that, and its
confirmation dismisses where it stands as before.

A claim in a currency the wallet didn't hold is withheld from the deck for the
same beat, then passed to `TokenCardStack` as `enteringMint`, which opens a
slot for it and fades it in. The caller names the card rather than the stack
diffing its own token list, because the case that most needs the animation, a
wallet that held nothing so the stack was never composed, is the one a diff
can't see.

The hold is timed from the wallet reporting itself drawn rather than from the
tap, so a slow tab doesn't spend it behind the loading spinner, and a reveal
nobody collects releases itself after 3s.
@bmc08gt
bmc08gt force-pushed the feat/wallet-claim-reveal branch from e204102 to 10b4a63 Compare August 28, 2026 21:52
@github-actions github-actions Bot added type: feature New functionality area: payments Payments, transfers, intents, billing area: tokens Token accounts, balances, token info area: session and removed type: feature New functionality labels Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: payments Payments, transfers, intents, billing area: session area: tokens Token accounts, balances, token info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant