feat: add trezor send - #1187
Conversation
Greptile SummaryThe PR integrates paired Trezor wallets into on-chain send and receive flows and strengthens session recovery and hardware-activity reconciliation.
Confidence Score: 3/5The PR should not merge until multi-wallet receive selection and restart-safe preservation of newly broadcast hardware activities are addressed. Global Receive silently loses Trezor access for users with multiple paired identities, and process-local snapshot protection can delete a newly created hardware-send activity and its contact metadata after an app restart. Files Needing Attention: app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveSheet.kt; app/src/main/java/to/bitkit/services/CoreService.kt
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveSheet.kt | Wires hardware address loading and verification into Receive, but removes the hardware option from global Receive when multiple paired wallets require selection. |
| app/src/main/java/to/bitkit/services/CoreService.kt | Preserves locally created sends during watcher lag only through process-local state, allowing restart-time deletion and contact loss. |
| app/src/main/java/to/bitkit/ui/screens/wallets/send/HwSendViewModel.kt | Adds a guarded sign-and-broadcast state machine with signed-transaction reuse for connectivity retries and wallet-scoped result persistence. |
| app/src/main/java/to/bitkit/repositories/HwWalletRepo.kt | Adds offline receive derivation, device verification, fee estimation, maximum calculation, and more targeted stale-session cleanup. |
| app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt | Extends request validation, amount limits, fee preparation, source switching, contact preparation, and success handling for hardware-funded sends. |
| app/src/main/java/to/bitkit/repositories/ActivityRepo.kt | Scopes hardware activity lookup and contact mutation to the selected external wallet identity. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Select paired Trezor] --> B[Enter on-chain request]
B --> C[Estimate fee from stored xpub]
C --> D[Review payment]
D --> E[Reconnect matching wallet identity]
E --> F[Sign on Trezor]
F --> G[Broadcast signed transaction]
G --> H[Create wallet-scoped activity]
H --> I[Reconcile watcher snapshot]
J[Open Trezor Receive] --> K[Derive unused address from xpub]
K --> L[Display QR and address]
L --> M[Reconnect matching identity]
M --> N[Verify address on device]
Reviews (1): Last reviewed commit: "feat: add trezor send and receive" | Re-trigger Greptile
jvsena42
left a comment
There was a problem hiding this comment.
Worth updating the journeys with the new flows
|
Could be split into 2 stacked PRs, one for Send, one for Receive 🙏🏻 |
eeed080 to
4afba39
Compare
4afba39 to
3182a99
Compare
|
Done — #1187 is now Send-only and conflict-free. Receive is split into the stacked #1189. iOS is split the same way: Send in synonymdev/bitkit-ios#688 and Receive in synonymdev/bitkit-ios#693. |
Thanks, recommending to use You might need to install it first: |
|
@jvsena42 Done. The journeys are split with the implementation: @ovitrif Thanks for the |
ovitrif
left a comment
There was a problem hiding this comment.
Two correctness defects block this change: switching funding sources can leave confirmation enabled for an underfunded source, and cached watcher snapshots can prevent pending-send expiry from being reevaluated. I also found regressions in activity seen-state preservation and hardware-recipient coverage, plus one Kotlin import violation.
6de987e to
09a681e
Compare
Description
This PR:
The Send UI follows the Bitkit Wallet design.
Receive support will follow in a separate stacked PR.
Linked Issues/Tasks
N/A
Screenshot / Video
QA Notes
Manual Tests
regression:Send → switch between Savings, Spending, and Trezor: available balance and fee-aware maximum update for each source.regression:cancel or disconnect during signing → retry: Bitkit reconnects without creating or broadcasting a duplicate transaction.Automated Checks
HwFundingSignerTest.ktandTrezorSessionFailureTest.kt: cover source coordination, timeouts, stale-session retry, retained signed transactions, and failure classification.HwWalletRepoTest.kt: cover pending sent activity and contact preservation during watcher reconciliation.ShopPaymentRequestTest.kt: cover hardware-wallet on-chain-only scan handling.