Skip to content

chore: remove hardware wallet dead code#27737

Merged
mathieuartu merged 4 commits into
mainfrom
chore/hw-overhaul-cleanup
Mar 24, 2026
Merged

chore: remove hardware wallet dead code#27737
mathieuartu merged 4 commits into
mainfrom
chore/hw-overhaul-cleanup

Conversation

@mathieuartu
Copy link
Copy Markdown
Contributor

@mathieuartu mathieuartu commented Mar 20, 2026

Description

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1496

Manual testing steps

no manual testing steps

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Mostly deletes unused Ledger Connect/BLE scanning UI and related hooks/tests; functional change is limited to how Ledger device model is sourced when forgetting a device, which could affect metrics labeling but not core wallet logic.

Overview
Removes the legacy Ledger BLE connection/scan flow UI (LedgerConnect, Scan, LedgerConnectionError) along with associated hooks (useBluetooth, useBluetoothDevices, useLedgerBluetooth, useLedgerDeviceForAccount) and their unit/snapshot tests.

Updates AccountActions hardware-account removal to stop relying on useLedgerDeviceForAccount; when a Ledger keyring becomes empty it now calls getDeviceId() from core/Ledger/Ledger before forgetLedger() to populate the HARDWARE_WALLET_FORGOTTEN metric, and adjusts mocks accordingly.

Written by Cursor Bugbot for commit 8bcc324. This will update automatically on new commits. Configure here.

@mathieuartu mathieuartu self-assigned this Mar 20, 2026
@mathieuartu mathieuartu requested a review from a team as a code owner March 20, 2026 12:56
@mathieuartu mathieuartu added the team-accounts-framework Accounts team label Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added size-XL risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 20, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 23, 2026
Copy link
Copy Markdown
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but the CI is failing

Copy link
Copy Markdown
Contributor

@montelaidev montelaidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested adding accounts and signing with ledger.

@mathieuartu mathieuartu enabled auto-merge March 24, 2026 10:07
@mathieuartu mathieuartu added this pull request to the merge queue Mar 24, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 24, 2026
@mathieuartu mathieuartu enabled auto-merge March 24, 2026 12:06
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/Views/AccountActions/AccountActions.tsx
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 24, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a refactoring/cleanup of Ledger hardware wallet Bluetooth connection infrastructure:

  1. Deleted components/hooks: The entire LedgerConnect/ directory (index.tsx, Scan.tsx, LedgerConnectionError.tsx, index.styles.ts) and several Ledger Bluetooth hooks (useBluetooth.ts, useBluetoothDevices.ts, useLedgerBluetooth.ts, useLedgerDeviceForAccount.ts, loadBleTransport.ts) have been completely removed.

  2. Modified AccountActions.tsx: The useLedgerDeviceForAccount hook was removed and replaced with a direct getDeviceId() async call in the "forget Ledger device" flow. This is the key behavioral change - instead of scanning for BLE devices to get the device ID, it now calls getDeviceId() directly from the Ledger core module.

  3. Impact: The changes affect the Ledger hardware wallet account management flow, specifically:

    • The "forget device" action in AccountActions (when removing a Ledger hardware wallet account)
    • The Ledger BLE connection UI (which appears to have been moved/replaced elsewhere)
  4. SmokeAccounts is the appropriate tag because it covers hardware wallet account management, account actions (including the AccountActions component that was modified), and account management workflows. The AccountActions component is directly modified in this PR.

  5. No other tags are needed - this is purely a Ledger hardware wallet refactoring with no impact on confirmations, network management, trading, identity sync, or other feature areas.

  6. No performance tests needed - these are UI/hook refactoring changes with no performance-sensitive code paths (no list rendering, no data loading changes, no startup/initialization changes).

Performance Test Selection:
The changes are a refactoring of Ledger Bluetooth connection hooks and UI components. No performance-sensitive code paths are affected - no list rendering, no data loading, no state management changes, no startup/initialization changes. The AccountActions change is a simple replacement of a hook with a direct async function call.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

@mathieuartu mathieuartu added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 905939b Mar 24, 2026
104 of 144 checks passed
@mathieuartu mathieuartu deleted the chore/hw-overhaul-cleanup branch March 24, 2026 15:20
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 24, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-XL team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants