When a user redeems XECX or FIRMA and the hot wallet is known to cover the amount, replace the generic listing toast with "Redeeming AMOUNT TICKER" and a spinner that animates to a check and "Redeemed" when the offer is taken. Unknown or insufficient hot-wallet balance still uses the listing toast. The websocket "Sold ..." notification is suppressed for these in-flight instant redeems.
Details
- Reviewers
Fabien - Group Reviewers
Restricted Project - Commits
- rABC09ad53356e0f: [Cashtab] Show redeeming progress toast for covered XECX and FIRMA
- cd cashtab && npm test -- --testPathPatterns='pendingRedeems|RedeemToast' --watchAll=false --coverage=false
- cd cashtab && npm test -- --testPathPatterns='TokenActions' --testNamePattern='redeem|FIRMA redeem|Firma|We can list an ALP' --watchAll=false --coverage=false
- Redeem XECX for an amount the hot wallet can cover: toast says "Redeeming <amount> XECX" with a spinner, then "Redeemed" with a check. No "Staked XEC listed for ..." toast.
- Redeem FIRMA the hot wallet can cover: same progress toast with FIRMA.
- Redeem XECX larger than the hot wallet, or with sweeper balance unavailable: still see the listing toast.
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed.
CodeRabbit Review
Diff : committed changes only
Compare : HEAD → master
Directory : work
────────────────────────────────────────
(\(\
(• .•) Reviewing code like a boss.
────────────────────────────────────────────────────────────────────────
minor [Functional Correctness] → ]8;;vscode://file//work/cashtab/src/components/Etokens/pendingRedeems.ts:138cashtab/src/components/Etokens/pendingRedeems.ts:138-172]8;; Any spend of a token output is treated as a redeem. waitForAgoraOfferRedeemed returns output.spentBy.txid for the first token output that has a spentBy. A cancel tx from the user also spends the offer token output. In that case the toast shows "Redeemed" even though no redeem occurred. Consider checking that the spending tx is an Agora accept, for example by matching the spending input against the hot wallet script or by confirming the spend is not a cancel.
────────────────────────────────────────────────────────────────────────
minor [Stability & Availability]
→ ]8;;vscode://file//work/cashtab/src/components/Etokens/RedeemToast.tsx:142cashtab/src/components/Etokens/RedeemToast.tsx:142-152]8;;
The toast has no terminal state after the poll timeout.
waitForAgoraOfferRedeemed resolves null after
DEFAULT_POLL_TIMEOUT_MS (90 s). The code ignores null. The toast was
created with autoClose: false, so it stays on "Redeeming ..." forever if
the hot wallet does not take the offer within 90 s. This case is
reachable: isHotWalletCoveredRedeem only proves balance, not execution.
Show a terminal message on null, for example "Redeem pending" plus
toast.update(toastId, { autoClose: 5000 }).────────────────────────────────────────
Review complete
2 findings ✔
Minor 2
7 files reviewed:
- cashtab/src/components/Etokens/RedeemToast.tsx
- cashtab/src/components/Etokens/Token/index.tsx
- cashtab/src/components/Etokens/__tests__/RedeemToast.test.tsx
- cashtab/src/components/Etokens/__tests__/TokenActions.test.js
- cashtab/src/components/Etokens/__tests__/pendingRedeems.test.ts
- cashtab/src/components/Etokens/pendingRedeems.ts
- cashtab/src/wallet/useWallet.ts
────────────────────────────────────────
Print all AI prompts: coderabbit review --show-prompts
Rebase on latest master and suppress the Sold toast for instant redeems. The poll often marks Redeemed before the websocket sale arrives; remember completed offer/sale txids briefly so that sale does not also toast Sold.
Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed.
CodeRabbit Review
Diff : committed changes only
Compare : HEAD → master
Directory : work
────────────────────────────────────────
(\(\
(• .•) The only good bug is a dead bug.
────────────────────────────────────────────────────────────────────────
minor [Stability & Availability] → ]8;;vscode://file//work/cashtab/src/components/Etokens/pendingRedeems.ts:164cashtab/src/components/Etokens/pendingRedeems.ts:164-179]8;; Remove the abort listener after normal sleep completion. Each polling iteration retains onAbort when its timer completes. A 90-second poll adds about 180 listeners to the same AbortSignal. Remove the listener in the timer callback before resolving.
────────────────────────────────────────────────────────────────────────
minor [Functional Correctness] → ]8;;vscode://file//work/cashtab/src/components/Etokens/RedeemToast.tsx:187cashtab/src/components/Etokens/RedeemToast.tsx:187-189]8;; Keep the original completion promise. Line 189 creates a promise and discards it. If the websocket sale resolves it before RedeemProgressToast mounts, line 136 creates a new unresolved promise. The toast can remain in the Redeeming state until polling succeeds or times out. Pass the promise from showInstantRedeemToast to RedeemProgressToast. Attach markRedeemed to that promise.
────────────────────────────────────────────────────────────────────────
major [Functional Correctness] → ]8;;vscode://file//work/cashtab/src/components/Etokens/pendingRedeems.ts:208cashtab/src/components/Etokens/pendingRedeems.ts:208-214]8;; Verify that the spending transaction is an Agora sale. A cancellation can spend the listing token output. This code returns the cancellation txid as a redeem txid. RedeemProgressToast then shows Redeemed for an offer that was cancelled. Fetch and classify the spending transaction before returning its txid. Only resolve this path for an Agora acceptance. Add a cancellation test.
────────────────────────────────────────────────────────────────────────
minor [Stability & Availability] → ]8;;vscode://file//work/cashtab/src/components/Etokens/RedeemToast.tsx:145cashtab/src/components/Etokens/RedeemToast.tsx:145-149]8;; End the pending state after polling times out. If waitForAgoraOfferRedeemed returns null, this handler leaves autoClose: false active and retains the pending registry entry. The user can see a permanent Redeeming toast. A later sale can also suppress the normal sale notification. Clear the pending redeem and update or dismiss the toast when polling times out.
────────────────────────────────────────
Review complete
4 findings ✔
Major 1
Minor 3
7 files reviewed:
- cashtab/src/components/Etokens/RedeemToast.tsx
- cashtab/src/components/Etokens/Token/index.tsx
- cashtab/src/components/Etokens/__tests__/RedeemToast.test.tsx
- cashtab/src/components/Etokens/__tests__/TokenActions.test.js
- cashtab/src/components/Etokens/__tests__/pendingRedeems.test.ts
- cashtab/src/components/Etokens/pendingRedeems.ts
- cashtab/src/wallet/useWallet.ts
────────────────────────────────────────
Print all AI prompts: coderabbit review --show-prompts
There already exist such a check when you use a payment request, can it be reused as a component?
not really the same thing in this case. We do have an animated check in both cases but one is in a modal and one is in a small toast.
The case itself here is distinct; we are modifying notifications (app only) for redeem, so we are suppressing the "you listed..." notification and the "you sold..." notification and instead showing one notification with content that updates based on the user action.
I've tested it in the built app and in local dev and it is working, imo an improvement from current user experience which is kind of confusing ("you listed..."). There will probably be some iterating forward to handle edge cases like missed redeems or potential timing issues. But I think it's better than what we do now.