feat: transfer to spending from HW wallet#616
Conversation
|
waiting for upstream branch merge |
…s correctly set later by markOnchainActivityAsTransfer)
Greptile SummaryThis PR adds the hardware-wallet transfer-to-spending flow. The main changes are:
Confidence Score: 4/5This is close, but the broadcast timeout path should be fixed before merging.
Bitkit/ViewModels/HwFundingSigner.swift and Bitkit/ViewModels/TransferViewModel.swift
|
| Filename | Overview |
|---|---|
| Bitkit/ViewModels/HwFundingSigner.swift | Adds the hardware signing coordinator and separates broadcast timeout handling, but the uncertain broadcast case still cannot be tracked. |
| Bitkit/ViewModels/TransferViewModel.swift | Adds hardware transfer coordination and records the paid order only after the signer returns successfully. |
| Bitkit/Services/TransferService.swift | Adds helper paths for creating hardware transfer activity and associating the funding transaction with a channel. |
Reviews (3): Last reviewed commit: "fix: port android warmup logic and recon..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 102f858661
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This comment was marked as outdated.
This comment was marked as outdated.
Pull request was converted to draft
|
draft for implement fixes |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e293b4920e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
draft for check comments |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d13e31089
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
code re-checked and video updated |
Refs #589
This PR adds the watch-only Transfer to Spending flow for funding a Lightning channel from a paired Trezor, with the on-chain funding transaction signed on the device. It builds on the connect-hardware flow (#614) and is an iOS port of bitkit-android's transfer-to-spending flow (synonymdev/bitkit-android#1039).
Description
Because iOS is Bluetooth-only in production, the Android USB/Bridge stale-session handling is limited to what the dev/E2E Bridge needs (the longer signing read timeout). The device-signing orchestration is extracted into a small
HwFundingSignercollaborator so the transfer view model keeps only the coordination that reuses the shared machinery. v1 funds from the native-segwit account only; multi-address-type spend is out of scope.QA Notes
OBS: driven on the Trezor Bridge emulator on regtest; please re-verify the full happy path and confirmation on a physical device.
Manual Tests
regression:Total Balance during paid-order → pending-channel → ready-channel does not double count the transfer amount while the pending channel appears.Automated Checks
BitkitTests/HwFundingSignerTests.swift(9),BitkitTests/TransferViewModelHwTests.swift(5),BitkitTests/HwWalletManagerFundingTests.swift(4), and sharedBitkitTests/HwTransferMocks.swift— cover the fee-reserve math (rate + both fallbacks), the reconnect/compose/sign/timeout orchestration and stale-session cleanup, the view model's error mapping and signing re-entrancy guard, and the native-segwit funding balance + funding-account resolution. 18/18 pass on the iPhone 16 simulator.xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace -scheme Bitkit -configuration Debug -destination 'platform=iOS Simulator,id=<iPhone 16>' ONLY_ACTIVE_ARCH=YES build(concrete simulator UDID +ONLY_ACTIVE_ARCH=YESbecause the Rust xcframeworks are arm64-only).node scripts/validate-translations.js: 0 errors (run withglobresolved locally, since this checkout has nopackage.json).BalanceManagerdouble-count fix orTransferServicechannel-resolution/activity marking: iOS'sLightningService/BlocktankService/CoreServicelack the protocol seams Android's repos have, so these are covered by the regtest E2E rather than isolated unit tests.Linked Issues/Tasks
Screenshot / Video
transfer-emulator.mov
close-channel.mov