feat(hw): add executeHardwareWalletOperation utility#29085
Conversation
Add shared utility that runs hardware wallet operations behind the standard readiness + awaiting-confirmation flow. Includes foundation helpers (getDeviceIdForAddress, normalizeReplacementGasFeeParams) as prerequisites.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…ress The provider now auto-derives the wallet type from the pending operation address, so callers only need to supply the address — not the wallet type. This removes the need for executeHardwareWalletOperation to compute and forward the wallet type explicitly.
…ationAddress LedgerSelectAccount uses setTargetWalletType for the Add Hardware Wallet flow, so it must remain in the context interface unchanged.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b608509. Configure here.
AI PR Analysis🚫 Merge safe: false | 🟠 Risk: high
AI analysis did not complete. Manual review recommended. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why SmokeAccounts: This tag covers QR-based hardware wallet account adding flows, which use the Why SmokeConfirmations: The The changes are additive (new function, new context property) with no breaking behavioral changes to existing flows, keeping risk at medium level. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|




Description
Add shared utility that runs hardware wallet operations behind the standard readiness + awaiting-confirmation flow. Includes foundation helpers (getDeviceIdForAddress, normalizeReplacementGasFeeParams) as prerequisites.
Changelog
CHANGELOG entry: null
Related issues
Related to: https://consensyssoftware.atlassian.net/browse/MUL-1741
Manual testing steps
This can only be tested via #29087
Screenshots/Recordings
Not applicable
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Touches the hardware wallet provider’s wallet-type resolution and introduces a new shared signing wrapper; mistakes could lead to incorrect adapter selection or confirmation/error UI behavior during signing.
Overview
Adds a shared
executeHardwareWalletOperationhelper to standardize hardware-wallet operations: it resolves device id from address, gates onensureDeviceReady, shows/hides the awaiting-confirmation UI, and centralizes rejection + error handling (including user-cancel suppression), with unit coverage.Updates
HardwareWalletProvider/context to support a newsetPendingOperationAddresshook and to auto-derive the effective wallet type from the in-flight operation address (viagetHardwareWalletTypeForAddress) when no explicittargetWalletTypeis set. Also tightens thesetTargetWalletTypecontext type and updates affected tests/mocks.Separately introduces a
ReplacementGasFeeValuestype alias and reuses it in replacement gas normalization/repricing helpers (no functional behavior change).Reviewed by Cursor Bugbot for commit 3db6970. Bugbot is set up for automated code reviews on this repo. Configure here.