Repository navigation
fix: open confirm for requests with a fixed amount - #1198
Conversation
|
Added to the 3.2.0 milestone with its Android twin synonymdev/bitkit-android#1763: this fix was opened after the 3.1.0 cut and closes no issue, so this PR carries the milestone itself. |
[Medium impact] The reviewed changes appear safe to merge. SummaryFixed-amount Bitcoin requests open Confirm directly. USDT requests open review with the amount locked.
Reviews (9) · Last reviewed commit: "fix: move to a hardware wallet only when..." · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
1 finding (1 P1). Routes a BIP21 request with an amount, and a converted Payment Request that only Bitcoin can pay, straight to Confirm. Reviewed f751a46, full tier, statically: iOS does not build on this reviewer's Linux host, so nothing was compiled or run here.
What I checked, and 5 candidates I ruled out
Read: the full diff, plus PaymentNavigationHelper (all three route functions), AppViewModel.handleScannedData (contact and BIP21 branches), SendSheet setup, cleanup and performPaymentValidationAfterSync, SendConfirmationView task, fee calculation and wallet switch, SendAmountView.onContinue, WalletViewModel.setUtxoSelection
Call sites traced: appropriateSendRoute (ScannerManager, SendEnterManuallyView, AppScene), openPaymentSheet (scanner, clipboard, deep link, Shop), paykitPaymentTerms readers
CI: lint, translations and build-local green; unit tests, integration tests and the @ios_gate e2e shard still running at review time
Ruled out
- Stale amount from an earlier recipient on the deep link, clipboard and Shop paths: each opens a new sheet whose
setUpSendcallswallet.resetSendState, and Confirm'sensureSendAmountFromScannedInvoicesIfNeededthen fills the invoice amount. Only the in-sheet scan reuses wallet state, and that is the pathprepareFixedAmountOnchainSendcovers. Manual entry resets before decoding. - Hardware wallet send skips the preview Amount used to build:
calculateTransactionFeecallshwSend.preparePreviewon Confirm itself, and the new coin selection guards on!hwSend.isActive. - Bound Bitcoin terms rejected later by the amount checks:
fixedBitcoinPaymentTermsreturns exactlyrequest.payment(using:)for the same method, soacceptsPaymentAmount(..., paymentTerms:)andreturnToAmountReviewIfNeededcompare equal values; an expired quote is refused byisValidand falls back to Amount. - Terms bound while USDT can still pay: the guard requires USDT off or no USDT endpoint, and the binding only runs when
paykitUsesUsdtis false; the tests cover both sides. - Swipe racing the new coin selection: real, but already raised in Greptile's thread on
SendConfirmationView.swift:428, so not repeated here.
Merge confidence: 3/5, one P1 (the @ios_gate e2e spec still expects the Amount step), and unit and e2e CI had not finished.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the review runtime does not report an effort setting)
|
Direct Confirm from direct-confirm-swipe.mp4 |
|
Amount → Confirm after edefd08 (local regtest): Continue, then an immediate swipe. Coins were chosen at 14:20:49.933 and the 143-sat fee at .974, and the send went out at 50.955. Tx amount-confirm-early-swipe.mp4 |
pwltr
left a comment
There was a problem hiding this comment.
Reviewed commit edefd08 through independent general and security review, targeted finding verification and peer comparison. The Debug simulator build, lint and 39 scoped tests passed.
[P2] Switching funding sources during fee calculation can leave sending disabled
If a Savings fee calculation is still running when the user switches to Spending or hardware, the newer calculation advances feeCalculationId without clearing isCalculatingOnchainFee. The old calculation then refuses to clear it because its ID is stale. The retained flag disables both the swipe and manual submission. Clear or transfer the loading state when a calculation is superseded, including early-return paths. This is the same issue already reported by ben-kaufman, confirmed separately by source tracing.
[P3] Direct confirmation skips the app’s minimum-amount check
A positive plain BIP21 amount now routes directly to Confirm, bypassing Amount’s 547-sat minimum. With manual coin selection, neither Confirm nor the picker restores that validation gate before submission. Apply the same minimum validation to direct confirmation. This confirms the missing application check; it does not establish how the native library will reject a sub-minimum transaction.
Review details
General review
Model: Claude Opus 5.5
Reasoning effort: xhigh
Security review
Model: Kimi K3
Reasoning effort: high
Finding verification, peer comparison and scoped validation
Model: GPT-6.1-sol
Reasoning effort: xhigh
|
After 1d5294f (local regtest): below-minimum-opens-amount.mp4 |
|
Replying to the review on edefd08:
|
|
Rebase reminder: #1014 fixes the same Paykit routing root cause, and it merged into master first (f75f2d5, 2026-11-04 09:08 UTC). This PR now conflicts with master in:
Before merging, rebase onto master:
|
A BIP21 request with an amount now opens Confirm instead of Amount when scanned, pasted or opened as a link. Confirm runs the saved automatic coin selection when it is reached without Amount and opens Amount if selection fails. In-sheet scans that open Confirm directly drop the amount and coin choices left by an earlier recipient. Zero-amount requests and contact payments still open Amount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pull request was converted to draft
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pwltr
left a comment
There was a problem hiding this comment.
Reviewed commit e29bdc5.
Medium — keep hardware funding selectable when Savings cannot fund a fixed request. With Autopilot, insufficient Savings and a sufficiently funded hardware wallet, an ordinary positive-amount Bitcoin scan or deep link passes the balance check but starts confirmation with Savings selected. If that coin selection fails, Confirm is popped or the sheet is dismissed before a funding-selection surface is preserved. The user must restart through a hardware-wallet entry despite already having enough funds. Keep Confirm or another funding-selection surface available on this failure. The pinned base opened Amount first, where hardware funding could be selected before confirmation. Confirmed by static path tracing; not reproduced on a device.
Review details
General review: GPT-6.1 Sol / high (Codex).
Finding verification: GPT-6.1 Sol / high (Codex).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On pwltr's Medium finding at e29bdc5 (hardware funding when Savings can't fund a fixed request): fixed in 3b7b5c3. When automatic coin selection fails on a fixed-amount Confirm because Savings can't cover the amount, Confirm now switches to the first paired hardware wallet whose balance covers it ( On the simulator, with Savings at 209 714 sats and a paired "Bitkit Test Trezor" at 549 577: a Test: CI on e29bdc5:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
CI on 6a06f57:
The test passes locally, 1/1. |
pwltr
left a comment
There was a problem hiding this comment.
Reviewed f39ae55 against f75f2d5.
When Savings cannot pay a fixed amount, Confirm now moves to a hardware wallet that can, and a failing hardware preview after that switch keeps Confirm with the error. One Low finding:
Low: in selectCoinsForDirectOnchainSendIfNeeded (SendConfirmationView.swift:2032), the switch runs for any coin-selection error, not only when Savings is short, and skips the error toast. A transient selection failure with enough Savings moves the payment to a hardware wallet without saying why. Consider switching only when the spendable on-chain balance is below the amount, and otherwise keeping the toast.
Review details
Claude Opus 5.5, effort high
Pull request was converted to draft
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On the Low finding in the review of f39ae55 (hardware switch on any coin-selection error): fixed in 1730836. It reproduced in the code. Test: Not driven on a device: a transient coin-selection failure can't be triggered on demand from the app. The Savings-short path is unchanged from the 3b7b5c3 device run. |

Twin: synonymdev/bitkit-android#1763
Companion: synonymdev/bitkit-e2e-tests#290 — updates
send.e2e.tsfor this route; the e2e gate needs it, so merge them together.Rebased onto master after #1014 merged. #1014 fixes the fixed-price Payment Request routing from the Slack report, so this PR covers the BIP21 routing only.
This PR:
Description
uint256=0counts as no amount.Out of Scope
Design
N/A — no new screens. The USDT review shows a loading state while the quote runs, using the existing review layout.
Preview
BIP21 with an amount opens Confirm and sends 10 000 sats:
01-bip21-amount-opens-confirm-and-sends.mp4
Below the minimum, the link shows Amount Too Low and opens nothing:
USDT link with an amount opens the fixed review; with no USDT the quote error and Try Again show there:
r9-fixed-amount.mp4
Savings below the amount: Confirm moves to a paired Trezor that covers it:
Zero-amount BIP21 still opens Amount:
02-bip21-no-amount-opens-amount.mp4
QA Notes
Setup
bitkit-dockeron local regtest,E2E_BUILDdebug build on a simulator, wallet funded from the localbitcoind. Clipboard set withxcrun simctl pbcopy. Hardware cases used the Trezor User Env emulator over Bridge.Journeys
scan-onchain-amount-to-confirm.xml— pasted BIP21 with an amount opens Confirm without Amount, tapping the amount keeps Confirm open, the send completes, and a below-minimum link shows Amount Too Lowscan-onchain-no-amount-to-amount.xml— pasted BIP21 without an amount still opens Amountonchain-accepted-result.xml— the fixed-amountbitcoin:link opens Confirm directlyrbf-own-send.xml— thebitcoin:link with an amount opens the review screen directlyusdt-payment-links-and-scans.xml— a USDT link with an amount opens the fixed reviewManual Tests
N/A
Automated Checks
PaymentNavigationHelperTests— on-chain BIP21 with an amount opens Confirm from both entry points, zero amount opens Amount, contact payments keep Amount, incoming on-chain requests open Confirm, the 547-sat minimumSendConfirmationSwipeTests— a scanned amount cannot be edited; the swipe waits for coins and the newest fee calculation; a failed hardware preview leaves Confirm only for its initial source; Savings below the amount moves to a covering hardware wallet, and any other coin-selection failure does notWalletViewModelSendTests— restoring the scanned amount clears coins chosen for an edited amountUsdtPaymentLinkTests— the fixed USDT amount stays with the recipient that set itScannerManagerTests— delayed-image case moved to 1 000 sats, above the new minimumUsdtWalletUITests— a USDT URI with an amount opens the fixed reviewSendConfirmationSwipeTests,SendConfirmationLifecycleTests,PaymentNavigationHelperTests71/71, checked in the xcresult. SwiftFormat clean.Evidence
d313a2…,2df859…).56f729…went through: fix: open confirm for requests with a fixed amount #1198 (comment)Gaps
@send_1and@send_2are updated in test: expect review screen for bip21 with an amount bitkit-e2e-tests#290; the iOS e2e gate passed against that branch.Models used
claude-opus-5-5(reasoning:Not exposed)claude-opus-5-5(reasoning:Not exposed)🤖 Generated with Claude Code