Skip to content

feat(hw): shared files for QR context and hardware wallet context merger#29084

Merged
montelaidev merged 1 commit into
mainfrom
feat/mul-1507-split-1-foundation
Apr 23, 2026
Merged

feat(hw): shared files for QR context and hardware wallet context merger#29084
montelaidev merged 1 commit into
mainfrom
feat/mul-1507-split-1-foundation

Conversation

@montelaidev

@montelaidev montelaidev commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Description

Changelog

CHANGELOG entry: null

Related issues

Related to: https://consensyssoftware.atlassian.net/browse/MUL-1741

Manual testing steps

This can only be tested via #29087

Screenshots/Recordings

Not applicable

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Medium Risk
Medium risk because it changes the gas fee parameters forwarded into cancel/speed-up transaction flows and adjusts hardware wallet context typing, which could affect transaction replacement behavior and hardware wallet connection UX.

Overview
Improves hardware-wallet and replacement-transaction handling by normalizing replacement gas fee params before calling speedUpTransaction/stopTransaction, ensuring only complete controller-supported fee fields are forwarded (otherwise undefined). Tests were added to cover legacy vs EIP-1559 normalization and the incomplete-fee edge case in LedgerTransactionModal.

Extends hardware wallet utilities by adding getDeviceIdForAddress (Ledger-only) and updating connection tips to include QR-specific guidance with new i18n strings. The hardware wallet context API is also loosened to allow setTargetWalletType(null).

Reviewed by Cursor Bugbot for commit da33c39. Bugbot is set up for automated code reviews on this repo. Configure here.

Add normalizeReplacementGasFeeParams gas utility, getDeviceIdForAddress
helper, QR connection tips, widen setTargetWalletType type, and refactor
LedgerTransactionModal to use normalizeReplacementGasFeeParams.
@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.

@metamaskbotv2 metamaskbotv2 Bot added the team-accounts-framework Accounts team label Apr 21, 2026
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes in this PR are focused on hardware wallet infrastructure and transaction gas fee handling:

  1. HardwareWallet helpers.ts: Added getDeviceIdForAddress() for Ledger BLE device reconnection, and added QR wallet connection tips to getConnectionTipsForWalletType(). This affects both Ledger and QR hardware wallet flows.

  2. HardwareWalletContext.tsx: Minor type widening - setTargetWalletType now accepts null in addition to HardwareWalletType. This is a small interface change that could affect hardware wallet provider behavior.

  3. LedgerTransactionModal.tsx: Refactored gas fee parameter handling to use the new normalizeReplacementGasFeeParams() utility. This affects speed-up and cancel transaction flows for Ledger hardware wallet users. Also removed a @ts-expect-error suppression.

  4. gas.ts: Added normalizeReplacementGasFeeParams() which properly normalizes legacy (gasPrice) and EIP-1559 (maxFeePerGas/maxPriorityFeePerGas) gas fee params for replacement transactions.

  5. locales/en.json: Added 3 new QR wallet connection tip strings.

Tag Selection Rationale:

  • SmokeAccounts: Covers QR-based hardware wallet account addition flows (adding QR hardware wallet accounts is explicitly mentioned in SmokeAccounts description). The QR connection tips and getDeviceIdForAddress() changes affect this flow.
  • SmokeConfirmations: Covers transaction confirmation flows including speed-up/cancel transactions. The LedgerTransactionModal is used during Ledger transaction signing and the gas fee normalization fix directly affects speed-up/cancel transaction replacement flows for Ledger users.

No other tags are needed as the changes are scoped to hardware wallet account management and transaction confirmation flows.

Performance Test Selection:
The changes are focused on hardware wallet connection logic, QR tip strings, and gas fee parameter normalization for replacement transactions. None of these changes affect UI rendering performance, data loading, account/network list components, or app startup/initialization in ways that would impact measurable performance metrics. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

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

@montelaidev montelaidev enabled auto-merge April 21, 2026 12:04
Comment thread locales/languages/en.json
"tip_bluetooth_permission_v12": "Nearby devices permission is granted",
"tip_stay_close": "Your device stays close to your phone"
"tip_stay_close": "Your device stays close to your phone",
"qr_tip_scan": "Your camera is ready to scan the QR code",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these supposed to be in this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's fine but this shows, alongside the other elements of this PR, that it was not properly split

* Normalizes replacement gas params so only controller-supported fee fields
* are forwarded to replacement transaction flows.
*/
export function normalizeReplacementGasFeeParams(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is duplicated in this PR: #29085. I see here it is used but not in the other one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will be used in subsequent prs

* Some hardware wallets, like Ledger over BLE, require a persisted device id
* to reconnect. Others, like QR signers, do not.
*/
export async function getDeviceIdForAddress(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly here. This one is also part of #29085

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will be used in subsequent prs

@montelaidev montelaidev added this pull request to the merge queue Apr 23, 2026
Merged via the queue into main with commit 8542e14 Apr 23, 2026
126 checks passed
@montelaidev montelaidev deleted the feat/mul-1507-split-1-foundation branch April 23, 2026 02:45
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.75.0 Issue or pull request that will be included in release 7.75.0 label Apr 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants