feat: add hw context, state manager and event handlers#26262
Conversation
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Risk Assessment: Medium
Tag Selection Rationale:
Performance Test Selection: |
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Risk Assessment: Medium
Tag Selection Rationale:
Performance Test Selection: |
|
Description
Part 3 of the hardware wallet connection & error management overhaul. This does not introduce user facing changes.
Cursor summary mentions the PR being medium risk, but nothing is wired yet, so this is largely low risk.
Final implementation will look like this (Figma designs):

Reference feature branch: #25519
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
No manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Mostly additive, internal hooks/context plus unit tests; no wiring into user flows yet, with limited risk aside from future integration correctness of the new state transitions.
Overview
Adds new hardware-wallet scaffolding: a
HardwareWalletContext(withuseHardwareWallet) to expose connection state, device selection, and HW actions via a single provider.Introduces
useHardwareWalletStateManagerto own HW connection state, device id, derivedwalletTypefrom the selected account, and mutable refs (adapter/isConnecting/abort), plus aresetStatehelper.Adds
useDeviceEventHandlersto translateDeviceEventpayloads into connection state transitions and normalized error states (including app-not-open, device-locked, connection-failed, and timeouts), and extends HWtypeswithDeviceSelectionState. Comprehensive unit tests cover these new hooks and context behavior.Written by Cursor Bugbot for commit 9898d2c. This will update automatically on new commits. Configure here.