feat: hw signing tracker#43302
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (6 files, +2016 -2)
|
Builds ready [664a41e]
⚡ Performance Benchmarks (Total: 🟢 20 pass · 🟡 5 warn · 🔴 0 fail)
Bundle size diffs
|
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 ddbd5ea. Configure here.
Builds ready [17043d1]
⚡ Performance Benchmarks (Total: 🟢 19 pass · 🟡 6 warn · 🔴 0 fail)
Bundle size diffs [🚀 Bundle size reduced!]
|

Description
This PR introduces a new hardware wallet signing tracker hook and improves retry logic for sequential hardware wallet signing.
Key changes:
Changelog
CHANGELOG entry: null
Related issues
Related to: https://consensyssoftware.atlassian.net/browse/MUL-1717
Manual testing steps
Not applicable
Screenshots/Recordings
Not applicable
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches hardware-wallet swap submission and transaction abort/state-machine events; behavior is complex but isolated to new hook + retry path and heavily unit-tested, with UI not yet wired per PR notes.
Overview
Adds
useHwSignTracker, which listens toTransactionControllerevents for bridge/swap HW flows and drives the hardware-wallet signature state machine (FirstSignatureSubmitted,TransactionSubmitted, reject/fail). It supports batch tracking (batchId, STX-style) and sequential tracking (per tx id), filters stale batches/retries viaretryGenerationRef, and exposescancelCurrentBatchto callabortTransactionSigningwith guarded cleanup.useHwSwapSubmissiongains optionalfirstSignatureDoneRef: onretrySubmission, approval is omitted from the submitted quote when the first signature is already done; the ref resets when the locked quoterequestIdchanges. The hook is exported from the hardware-wallets index with types. Large unit test coverage accompanies both areas.Reviewed by Cursor Bugbot for commit 17043d1. Bugbot is set up for automated code reviews on this repo. Configure here.