feat: add trezor send and receive - #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
Description
This PR:
The Send and Receive UI follows the Bitkit Wallet design.
Preview
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
HwSendViewModelTest.ktandHwReceiveViewModelTest.kt: cover signing, passphrases, stale-session retry, safe broadcast retry, result retention, address loading, and device verification.AppViewModelSendFlowTest.kt,HwWalletRepoTest.kt, andTrezorRepoTest.kt: cover source selection, duplicate preparation, fee-aware maximums, offline composition, and session cleanup.CoreServiceTest.kt,TransferViewModelTest.kt,TrezorExceptionExtTest.kt, andReceiveInvoiceUtilsTest.kt: cover activity reconciliation, transfer retry, session classification, and hardware receive QR content.