refactor: hw provider and hooks for cleaner architecture and readability#26676
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The public API (HardwareWalletProvider, useHardwareWallet, isUserCancellation) remains unchanged. This is purely an internal refactoring with no functional changes to hardware wallet behavior. Selected SmokeAccounts because:
The risk is medium because:
Performance Test Selection: |
Description
Part "4.5" of the hardware wallet connection & error management overhaul. This does not introduce user facing changes.
Will close:
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
Medium Risk
Refactors core hardware-wallet connection flow and transport monitoring into new hooks, which could subtly change state transitions (scanning/connecting/error/ready) or cleanup behavior. No new security surface, but regressions could impact device connectivity and error handling.
Overview
Refactors
HardwareWalletProviderby extracting adapter lifecycle, transport monitoring, device discovery, and connection/retry/close logic into new hooks (useAdapterLifecycle,useTransportMonitoring,useDeviceDiscovery,useDeviceConnectionFlow) and wiring the provider to these hook APIs.Simplifies the connecting UI contract by removing adapter-provided
connectionTips:getConnectionTips()is removed fromHardwareWalletAdapter(and Ledger/NonHardware adapters),HardwareWalletBottomSheetno longer acceptsconnectionTips, andConnectingContentnow derives tips viagetConnectionTipsForWalletType()inhelpers.ts. Also makes bottom-sheetonCloserequired and updates tests accordingly.Written by Cursor Bugbot for commit b84edf3. This will update automatically on new commits. Configure here.