Skip to content

feat: wire qr code errors#29741

Merged
montelaidev merged 19 commits into
mainfrom
feat/qr-siginig-2
May 13, 2026
Merged

feat: wire qr code errors#29741
montelaidev merged 19 commits into
mainfrom
feat/qr-siginig-2

Conversation

@montelaidev

@montelaidev montelaidev commented May 5, 2026

Copy link
Copy Markdown
Contributor

Description

Wires the QR scan errors from PR 2 into pairing and signing flows. QR scan failures now surface through the hardware wallet bottom sheet with retry support, signing confirmations can reopen the scanner from the error CTA, and replacement transaction gas params are normalized through the shared helper.

This is PR 3 of 3 and is stacked on #29388.

Changelog

CHANGELOG entry: Improved retry behavior when QR hardware wallet signing scans fail

Related issues

Refs: MUL-1665
Resolves: https://consensyssoftware.atlassian.net/browse/MUL-1513?atlOrigin=eyJpIjoiZThlODA2MTIwODU4NDA5ZmI1YjdlMjJkM2Q2ODdlOWQiLCJwIjoiaiJ9

Manual testing steps

Feature: QR hardware signing retry

  Scenario: user retries a failed QR signing scan
    Given the user is signing with a QR-based hardware wallet
    When the user scans an invalid QR code
    Then the hardware wallet bottom sheet displays the QR scan error
    When the user taps Try again
    Then the QR scanner reopens for another signing scan

Screenshots/Recordings

Before

After

Screen_Recording_20260512_222018_MetaMask.mp4

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.

Made with Cursor


Note

Medium Risk
Touches QR hardware-wallet signing/pairing flows and error-handling/retry behavior, which can impact user ability to connect/sign if regressions occur. Changes are mostly additive/guarded and covered by expanded unit tests, but they alter control flow around modal visibility and error deduping.

Overview
Routes QR-hardware scan failures (non-UR, decode errors, wrong UR type, scan exceptions) out of AnimatedQRScannerModal into the Hardware Wallet bottom sheet via a new useQrScanErrorForwarding hook, enabling Try again retry to reopen scanners in pairing (ConnectQRHardware), signing (QRSigningDetails), and confirmation QR signing (QRInfo).

Hardens scanner behavior by deduplicating repeated error frames (isSameScanError), avoiding repeated decoder resets/analytics, and resetting decoder/dedup state on visible transitions; also makes analytics sending resilient to failures.

Improves QR transport handling by centralizing camera permission status constants (CAMERA_PERMISSION_STATUS) and updating QRWalletAdapter to request permission for any non-granted status; adds adapter factory support for HardwareWalletType.Qr and normalizes replacement-tx gas param typing via shared ReplacementTxParams.

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

@montelaidev montelaidev requested review from a team as code owners May 5, 2026 14:25
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 5, 2026
@github-actions

github-actions Bot commented May 5, 2026

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.

@montelaidev montelaidev changed the base branch from main to feat/qr-siginig-1 May 5, 2026 14:25
@montelaidev montelaidev self-assigned this May 5, 2026
@montelaidev montelaidev added the team-accounts-framework Accounts team label May 5, 2026
@montelaidev montelaidev changed the title Feat/qr siginig 2 feat: wire qr code errors May 5, 2026
Comment thread app/components/Views/ConnectQRHardware/index.tsx
Base automatically changed from feat/qr-siginig-1 to main May 6, 2026 13:57
Comment thread app/core/HardwareWallet/adapters/QRWalletAdapter.test.ts Outdated
Comment thread app/core/HardwareWallet/hooks/useQrConfirm.ts Outdated
Comment thread app/components/UI/QRHardware/QRSigningDetails.tsx
@montelaidev montelaidev removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 11, 2026
Comment thread app/components/UI/QRHardware/AnimatedQRScanner.tsx
Comment thread app/components/UI/QRHardware/AnimatedQRScanner.utils.ts
Comment thread app/core/HardwareWallet/adapters/QRWalletAdapter.ts Outdated
Comment thread app/components/UI/QRHardware/AnimatedQRScanner.tsx
Comment thread app/components/Views/confirmations/components/qr-info/qr-info.tsx
@david0xd

Copy link
Copy Markdown
Contributor

I've reviewed the code. Changes look decent and reasonable. I haven't tested, so just please find someone to do some additional manual testing if needed.

@owencraston

Copy link
Copy Markdown
Contributor

@montelaidev this change seems to be working during onboarding and with dapp signing but for sending and swapping its really messed up. I think these issues might stem for this bug but either way I am seeing really weird results...

  • first it shows the qr code in full screen mode
  • then it shows the qr code in popup mode
  • the transaction has to be signed multiple times.

Here is a video:

screen-20260512-190410-1778626845710.2.mp4

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: %
click to see 🤖 AI reasoning details

E2E Test Selection:
Fallback: AI analysis did not complete successfully. Running all tests.

Performance Test Selection:
Fallback: AI analysis did not complete successfully. Running all performance tests.

View GitHub Actions results

@cursor cursor Bot left a comment

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.

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.

Reviewed by Cursor Bugbot for commit 49f5ad6. Configure here.

return () => {
setQrScanRetryHandler?.(null);
};
}, [setQrScanRetryHandler, showScanner]);

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.

Signing retry doesn't reopen QR scanner

High Severity

The QR scan retry handlers registered in QRSigningDetails and QRInfo (which call showScanner()/setScannerVisible(true)) are never invoked during signing flows. When handleRetryQrScan in the provider runs and operationTypeRef.current is not null (signing is in progress), it transitions to AwaitingConfirmation and returns early without calling qrScanRetryHandlerRef.current(). The scanner stays closed, leaving the user stuck on the awaiting-confirmation bottom sheet with no way to re-scan. This contradicts the PR's stated goal that "signing confirmations can reopen the scanner from the error CTA."

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 49f5ad6. Configure here.

@sonarqubecloud

Copy link
Copy Markdown

@montelaidev

Copy link
Copy Markdown
Contributor Author

@montelaidev this change seems to be working during onboarding and with dapp signing but for sending and swapping its really messed up. I think these issues might stem for this bug but either way I am seeing really weird results...

  • first it shows the qr code in full screen mode
  • then it shows the qr code in popup mode
  • the transaction has to be signed multiple times.

Here is a video:

screen-20260512-190410-1778626845710.2.mp4

Will be fixed in this pr

@montelaidev montelaidev added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit 34ffb5c May 13, 2026
115 of 116 checks passed
@montelaidev montelaidev deleted the feat/qr-siginig-2 branch May 13, 2026 11:06
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-XL team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants