refactor: migrate LedgerSelectAccount to useHardwareWallet#26864
refactor: migrate LedgerSelectAccount to useHardwareWallet#26864mathieuartu wants to merge 17 commits into
LedgerSelectAccount to useHardwareWallet#26864Conversation
|
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. |
LedgerSelectAccount to useHardwareWallet
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.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: These changes directly impact hardware wallet account import flows, which are covered under SmokeAccounts (QR-based hardware wallet accounts, account creation/import flows, account selector integration). The refactor affects how Ledger accounts are discovered, unlocked, and added to the wallet, and modifies navigation behavior (pop(2), goBack on cancel), which can impact multi-account workflows. The Root component now wraps the entire app in HardwareWalletProvider, which changes global context initialization and could affect any flow that depends on hardware wallet context. Although most E2E tests do not use hardware wallets, SmokeAccounts is the only tag that explicitly covers hardware wallet account flows and account management integration. No changes were made to confirmations, swaps, networks, perps, predictions, snaps, or multi-chain APIs. Therefore, additional tags (e.g., SmokeConfirmations, SmokeTrade, SmokeNetworkExpansion, FlaskBuildTests) are not required. Given the architectural change (new provider at root + async initialization logic in LedgerSelectAccount), risk is medium and focused on account/hardware wallet flows. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
Wires the new hardware wallet management system to the "Create new Ledger account" flow.
This PR is part of the hardware wallet connection & error management overhaul.
Reference feature branch: #25519
Changelog
CHANGELOG entry: refactor: migrate LedgerSelectAccount to useHardwareWallet
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1497
Manual testing steps
Screenshots/Recordings
Before
After
Enregistrement.de.l.ecran.2026-03-03.a.10.15.14.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Updates the Ledger add-account flow to rely on the new hardware wallet provider and readiness gating, which can affect device connection, navigation, and error handling across a key user path. Also wraps the app in
HardwareWalletProvider, introducing new global context dependency at the root.Overview
LedgerSelectAccountis refactored to useuseHardwareWalletinstead ofLedgerConnect/useLedgerBluetooth. On mount it sets the target wallet type, callsensureDeviceReady, and automatically fetches the first page of Ledger accounts; if readiness fails/cancels it navigates back, and while waiting it shows a new loading state.Pagination, HD-path refetch, and unlock now call Ledger operations directly with simpler error handling (inline error messages + blocking modal during operations), add a guard to prevent double-unlock, and re-check
ensureDeviceReady(deviceId)before unlocking. Analytics tracking is updated to fire once when accounts load and uses the sanitized selected device name fordevice_model.App root is updated to mount
HardwareWalletProvideraroundApp, and theLedgerSelectAccounttest suite is rewritten to mockuseHardwareWalletand validate the new readiness/loading/error behaviors.Written by Cursor Bugbot for commit abdcff1. This will update automatically on new commits. Configure here.