Skip to content

feat: add QR adapter#41488

Merged
david0xd merged 7 commits intomainfrom
dd/add-qr-adapter
Apr 7, 2026
Merged

feat: add QR adapter#41488
david0xd merged 7 commits intomainfrom
dd/add-qr-adapter

Conversation

@david0xd
Copy link
Copy Markdown
Contributor

@david0xd david0xd commented Apr 5, 2026

Description

This PR adds QR adapter which will be used for the new QR hardware wallet flow.

Changelog

CHANGELOG entry: null

Related issues

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

Manual testing steps

Nothing specifically here that we can manually test.
Unit tests are added to cover all new functionalities.

Screenshots/Recordings

Before

No UI changes. Nothing to show here.

After

No UI changes. Nothing to show here.

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

Medium Risk
Introduces a new QrAdapter and adds camera permission probing/requesting to shared webConnectionUtils, which could affect hardware-wallet permission UX and error mapping if browser permission APIs behave unexpectedly.

Overview
Adds QR hardware wallet support via a new QrAdapter that manages QR-flow connection state and gates ensureDeviceReady on browser camera permission, emitting mapped device events/errors for denied/prompt/unknown cases.

Extends webConnectionUtils to support camera availability checks, camera permission probing (checkCameraPermission/checkCameraPermissionState), and camera permission requests (requestCameraPermission), and wires these into checkHardwareWalletPermission/requestHardwareWalletPermission for HardwareWalletType.Qr (with a no-op event subscription path).

Updates error-property mapping to include QR_WALLET_ERROR_MAPPINGS, and expands mocks and unit tests to cover the new QR adapter and camera permission behaviors.

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

@david0xd david0xd self-assigned this Apr 5, 2026
@david0xd david0xd added the team-accounts-framework Accounts team label Apr 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

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.

@metamaskbot metamaskbot added the team-extension-platform Extension Platform team label Apr 5, 2026
@david0xd david0xd changed the title Add QR adapter feat: add QR adapter Apr 5, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 5, 2026

✨ Files requiring CODEOWNER review ✨

🔑 @MetaMask/accounts-engineers (10 files, +632 -0)
  • 📁 ui/
    • 📁 contexts/
      • 📁 hardware-wallets/
        • 📁 __mocks__/
          • 📄 webConnectionUtils.ts +31 -0
        • 📁 adapters/
          • 📄 factory.test.ts +9 -0
          • 📄 factory.ts +3 -0
          • 📄 index.ts +1 -0
          • 📄 QrAdapter.test.ts +135 -0
          • 📄 QrAdapter.ts +120 -0
          • 📄 constants.ts +10 -0
          • 📄 errors.ts +2 -0
          • 📄 webConnectionUtils.test.ts +219 -0
          • 📄 webConnectionUtils.ts +102 -0

@david0xd david0xd force-pushed the dd/add-qr-adapter branch from bd61c26 to 51fcdfa Compare April 5, 2026 20:50
@github-actions github-actions bot added the size-L label Apr 5, 2026
@david0xd david0xd marked this pull request as ready for review April 5, 2026 21:05
@david0xd david0xd requested a review from a team as a code owner April 5, 2026 21:05
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 5, 2026

Builds ready [51fcdfa]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24010194373 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -13%
  • loadNewAccount/total: -13%
  • bridgeUserActions/bridge_search_token: -14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.5s
  • 🟡 confirmTx/FCP: p75 2.5s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/domContentLoaded: -12%
  • startupStandardHome/domInteractive: +13%
  • startupStandardHome/backgroundConnect: +16%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -15%
  • startupPowerUserHome/uiStartup: -15%
  • startupPowerUserHome/domInteractive: -12%
  • startupPowerUserHome/backgroundConnect: +100%
  • startupPowerUserHome/numNetworkReqs: -19%
  • startupStandardHome/uiStartup: -13%
  • startupStandardHome/load: -12%
  • startupStandardHome/domContentLoaded: -12%
  • startupStandardHome/backgroundConnect: -33%
  • startupStandardHome/firstReactRender: -24%
  • startupStandardHome/loadScripts: -12%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -16%
  • startupStandardHome/domInteractive: -59%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/backgroundConnect: -33%
  • startupPowerUserHome/setupStore: -28%
  • startupStandardHome/domInteractive: -32%
  • startupStandardHome/backgroundConnect: -14%
  • startupStandardHome/initialActions: +11%
  • startupStandardHome/setupStore: -54%
  • startupPowerUserHome/uiStartup: -13%
  • startupPowerUserHome/domInteractive: -13%
  • startupPowerUserHome/backgroundConnect: -37%
  • startupPowerUserHome/firstReactRender: -11%
  • startupPowerUserHome/setupStore: +17%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 656ms
  • 🔴 startupPowerUserHome/INP: p75 688ms
  • 🟡 startupPowerUserHome/LCP: p75 3.6s
  • 🟡 startupPowerUserHome/LCP: p75 3.5s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/metricsToWalletReadyScreen: -17%
  • onboardingImportWallet/doneButtonToHomeScreen: -75%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +32%
  • onboardingImportWallet/total: -38%
  • onboardingNewWallet/skipBackupToMetricsScreen: -11%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: +15%
  • onboardingNewWallet/doneButtonToAssetList: -29%
  • onboardingNewWallet/total: -24%
  • assetDetails/assetClickToPriceChart: -62%
  • assetDetails/total: -62%
  • solanaAssetDetails/assetClickToPriceChart: -62%
  • solanaAssetDetails/total: -62%
  • importSrpHome/openAccountMenuAfterLogin: -76%
  • importSrpHome/homeAfterImportWithNewWallet: -37%
  • importSrpHome/total: -31%
  • sendTransactions/openSendPageFromHome: +81%
  • sendTransactions/reviewTransactionToConfirmationPage: +19%
  • sendTransactions/total: +20%
  • swap/openSwapPageFromHome: -86%
  • swap/fetchAndDisplaySwapQuotes: +32%
  • swap/total: +14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/FCP: p75 2.4s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 216ms
  • 🟡 importSrpHome/FCP: p75 2.5s
  • 🟡 sendTransactions/INP: p75 240ms
  • 🟡 sendTransactions/FCP: p75 2.6s
  • 🟡 swap/FCP: p75 2.6s
🌐 Dapp Page Load Benchmarks

Current Commit: 51fcdfa | Date: 4/5/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 952ms (±38ms) 🟢 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 671ms (±34ms) 🟢 | historical mean value: 728ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±11ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 952ms 38ms 927ms 1.23s 978ms 1.23s
domContentLoaded 671ms 34ms 653ms 921ms 692ms 921ms
firstPaint 80ms 11ms 68ms 172ms 88ms 172ms
firstContentfulPaint 80ms 11ms 68ms 172ms 88ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 3.52 KiB (0.03%)

Copy link
Copy Markdown

@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.

Reviewed by Cursor Bugbot for commit 69ff639. Configure here.

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 5, 2026

Builds ready [69ff639]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24010892492 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount
🟡 load_new_account
[Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • bridgeUserActions/bridge_load_asset_picker: +30%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.6s
  • 🟡 confirmTx/FCP: p75 2.6s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: -13%
  • startupStandardHome/load: -14%
  • startupStandardHome/domContentLoaded: -16%
  • startupStandardHome/backgroundConnect: +11%
  • startupStandardHome/firstReactRender: -13%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -20%
  • startupStandardHome/numNetworkReqs: -13%
  • startupPowerUserHome/backgroundConnect: +88%
  • startupPowerUserHome/numNetworkReqs: +17%
  • startupStandardHome/uiStartup: -15%
  • startupStandardHome/load: -14%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/backgroundConnect: -37%
  • startupStandardHome/firstReactRender: -24%
  • startupStandardHome/loadScripts: -14%
  • startupStandardHome/setupStore: -14%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -19%
  • startupPowerUserHome/firstPaint: -10%
  • startupPowerUserHome/numNetworkReqs: +44%
  • startupStandardHome/domInteractive: -53%
  • startupStandardHome/firstReactRender: +11%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/setupStore: +14%
  • startupPowerUserHome/backgroundConnect: -21%
  • startupPowerUserHome/setupStore: -43%
  • startupStandardHome/uiStartup: -11%
  • startupStandardHome/domInteractive: -39%
  • startupStandardHome/backgroundConnect: -24%
  • startupStandardHome/initialActions: -44%
  • startupStandardHome/setupStore: -60%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/backgroundConnect: -27%
  • startupPowerUserHome/setupStore: -12%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 664ms
  • 🔴 startupPowerUserHome/INP: p75 624ms
  • 🟡 startupPowerUserHome/LCP: p75 3.7s
  • 🟡 startupPowerUserHome/LCP: p75 3.6s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/srpButtonToSrpForm: +10%
  • onboardingImportWallet/metricsToWalletReadyScreen: -34%
  • onboardingImportWallet/doneButtonToHomeScreen: -75%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +32%
  • onboardingImportWallet/total: -39%
  • onboardingNewWallet/createPwToRecoveryScreen: +17%
  • onboardingNewWallet/skipBackupToMetricsScreen: -10%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: +12%
  • onboardingNewWallet/doneButtonToAssetList: -35%
  • onboardingNewWallet/total: -27%
  • assetDetails/assetClickToPriceChart: -55%
  • assetDetails/total: -55%
  • solanaAssetDetails/assetClickToPriceChart: -61%
  • solanaAssetDetails/total: -61%
  • importSrpHome/openAccountMenuAfterLogin: -73%
  • importSrpHome/homeAfterImportWithNewWallet: -37%
  • importSrpHome/total: -31%
  • sendTransactions/openSendPageFromHome: +99%
  • sendTransactions/selectTokenToSendFormLoaded: -15%
  • swap/openSwapPageFromHome: -86%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/FCP: p75 2.4s
  • 🟡 solanaAssetDetails/FCP: p75 2.4s
  • 🟡 importSrpHome/INP: p75 224ms
  • 🟡 importSrpHome/FCP: p75 2.5s
  • 🟡 sendTransactions/INP: p75 208ms
  • 🟡 sendTransactions/FCP: p75 2.6s
  • 🟡 swap/FCP: p75 2.5s
🌐 Dapp Page Load Benchmarks

Current Commit: 69ff639 | Date: 4/5/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±45ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 736ms (±43ms) 🟢 | historical mean value: 728ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±11ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 45ms 1.02s 1.37s 1.06s 1.37s
domContentLoaded 736ms 43ms 710ms 1.05s 745ms 1.05s
firstPaint 85ms 11ms 72ms 176ms 96ms 176ms
firstContentfulPaint 85ms 11ms 72ms 176ms 96ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 3.45 KiB (0.03%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 5, 2026

Builds ready [2d502fa]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24011636405 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount
🟡 load_new_account
[Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • bridgeUserActions/bridge_load_page: -14%
  • bridgeUserActions/bridge_load_asset_picker: -26%
  • bridgeUserActions/bridge_search_token: -24%
  • bridgeUserActions/total: -24%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.4s
  • 🟡 confirmTx/FCP: p75 2.4s
  • 🟡 bridgeUserActions/FCP: p75 2.4s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: -15%
  • startupStandardHome/load: -17%
  • startupStandardHome/domContentLoaded: -19%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -22%
  • startupStandardHome/numNetworkReqs: -16%
  • startupPowerUserHome/uiStartup: -11%
  • startupPowerUserHome/domInteractive: -12%
  • startupPowerUserHome/backgroundConnect: +81%
  • startupPowerUserHome/setupStore: +17%
  • startupStandardHome/uiStartup: -11%
  • startupStandardHome/load: -10%
  • startupStandardHome/domInteractive: +11%
  • startupStandardHome/firstPaint: +23%
  • startupStandardHome/backgroundConnect: -31%
  • startupStandardHome/firstReactRender: -20%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -10%
  • startupPowerUserHome/numNetworkReqs: -38%
  • startupStandardHome/domInteractive: -56%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/setupStore: +21%
  • startupStandardHome/numNetworkReqs: -16%
  • startupPowerUserHome/uiStartup: -14%
  • startupPowerUserHome/backgroundConnect: -40%
  • startupPowerUserHome/setupStore: +11%
  • startupStandardHome/domInteractive: -30%
  • startupStandardHome/backgroundConnect: -16%
  • startupStandardHome/initialActions: +11%
  • startupStandardHome/setupStore: -54%
  • startupPowerUserHome/uiStartup: -11%
  • startupPowerUserHome/domInteractive: -15%
  • startupPowerUserHome/backgroundConnect: -35%
  • startupPowerUserHome/setupStore: +14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 640ms
  • 🔴 startupPowerUserHome/INP: p75 680ms
  • 🟡 startupPowerUserHome/LCP: p75 3.4s
  • 🟡 startupPowerUserHome/LCP: p75 3.5s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/confirmSrpToPwForm: -10%
  • onboardingImportWallet/doneButtonToHomeScreen: -77%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +42%
  • onboardingImportWallet/total: -39%
  • onboardingNewWallet/skipBackupToMetricsScreen: -13%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: +21%
  • onboardingNewWallet/doneButtonToAssetList: -27%
  • onboardingNewWallet/total: -23%
  • assetDetails/assetClickToPriceChart: -65%
  • assetDetails/total: -65%
  • solanaAssetDetails/assetClickToPriceChart: -63%
  • solanaAssetDetails/total: -63%
  • importSrpHome/openAccountMenuAfterLogin: -69%
  • importSrpHome/homeAfterImportWithNewWallet: -41%
  • importSrpHome/total: -35%
  • sendTransactions/openSendPageFromHome: +133%
  • sendTransactions/total: +11%
  • swap/openSwapPageFromHome: -87%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/INP: p75 208ms
  • 🟡 assetDetails/FCP: p75 2.4s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 216ms
  • 🟡 importSrpHome/FCP: p75 2.4s
  • 🟡 sendTransactions/INP: p75 264ms
  • 🟡 sendTransactions/FCP: p75 2.5s
  • 🟡 swap/FCP: p75 2.5s
🌐 Dapp Page Load Benchmarks

Current Commit: 2d502fa | Date: 4/5/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 721ms (±36ms) 🟢 | historical mean value: 728ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±11ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1.00s 1.31s 1.05s 1.31s
domContentLoaded 721ms 36ms 702ms 993ms 734ms 993ms
firstPaint 85ms 11ms 64ms 168ms 104ms 168ms
firstContentfulPaint 85ms 11ms 64ms 168ms 104ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 3.46 KiB (0.03%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 6, 2026

Builds ready [19b9d1f]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24027368768 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount
🟡 load_new_account
[Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • bridgeUserActions/bridge_load_asset_picker: +33%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.4s
  • 🟡 confirmTx/FCP: p75 2.4s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/domInteractive: +10%
  • startupStandardHome/firstPaint: +16%
  • startupStandardHome/backgroundConnect: +18%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -12%
  • startupPowerUserHome/uiStartup: -11%
  • startupPowerUserHome/domInteractive: -11%
  • startupPowerUserHome/backgroundConnect: +119%
  • startupPowerUserHome/setupStore: +17%
  • startupPowerUserHome/numNetworkReqs: +17%
  • startupStandardHome/uiStartup: -15%
  • startupStandardHome/load: -15%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/firstPaint: -17%
  • startupStandardHome/backgroundConnect: -37%
  • startupStandardHome/firstReactRender: -24%
  • startupStandardHome/loadScripts: -14%
  • startupStandardHome/setupStore: -14%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -19%
  • startupPowerUserHome/numNetworkReqs: -46%
  • startupStandardHome/domInteractive: -58%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/uiStartup: -15%
  • startupPowerUserHome/backgroundConnect: -42%
  • startupStandardHome/domInteractive: -31%
  • startupStandardHome/backgroundConnect: -20%
  • startupStandardHome/initialActions: -44%
  • startupStandardHome/setupStore: -63%
  • startupPowerUserHome/domInteractive: -13%
  • startupPowerUserHome/backgroundConnect: -19%
  • startupPowerUserHome/setupStore: +13%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 680ms
  • 🔴 startupPowerUserHome/INP: p75 696ms
  • 🟡 startupPowerUserHome/LCP: p75 3.2s
  • 🟡 startupPowerUserHome/LCP: p75 3.8s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/metricsToWalletReadyScreen: -15%
  • onboardingImportWallet/doneButtonToHomeScreen: -73%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +23%
  • onboardingImportWallet/total: -39%
  • onboardingNewWallet/skipBackupToMetricsScreen: -16%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -20%
  • onboardingNewWallet/doneButtonToAssetList: -25%
  • onboardingNewWallet/total: -21%
  • assetDetails/assetClickToPriceChart: -68%
  • assetDetails/total: -68%
  • solanaAssetDetails/assetClickToPriceChart: -61%
  • solanaAssetDetails/total: -61%
  • importSrpHome/openAccountMenuAfterLogin: -78%
  • importSrpHome/homeAfterImportWithNewWallet: -39%
  • importSrpHome/total: -34%
  • sendTransactions/openSendPageFromHome: +68%
  • swap/openSwapPageFromHome: -93%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +12%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/FCP: p75 2.4s
  • 🟡 solanaAssetDetails/FCP: p75 2.4s
  • 🟡 importSrpHome/FCP: p75 2.4s
  • 🟡 sendTransactions/FCP: p75 2.4s
  • 🟡 swap/FCP: p75 2.4s
🌐 Dapp Page Load Benchmarks

Current Commit: 19b9d1f | Date: 4/6/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.02s (±39ms) 🟡 | historical mean value: 1.03s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 715ms (±36ms) 🟢 | historical mean value: 727ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 83ms (±11ms) 🟢 | historical mean value: 87ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.02s 39ms 995ms 1.30s 1.07s 1.30s
domContentLoaded 715ms 36ms 692ms 983ms 739ms 983ms
firstPaint 83ms 11ms 64ms 160ms 100ms 160ms
firstContentfulPaint 83ms 11ms 64ms 160ms 100ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 341 Bytes (0%)
  • common: 3.46 KiB (0.03%)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 6, 2026

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 6, 2026

Builds ready [46822f7]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24032526838 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -14%
  • loadNewAccount/total: -14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.4s
  • 🟡 confirmTx/FCP: p75 2.4s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/domContentLoaded: -11%
  • startupStandardHome/domInteractive: +22%
  • startupStandardHome/backgroundConnect: +19%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -15%
  • startupStandardHome/setupStore: +14%
  • startupPowerUserHome/uiStartup: -14%
  • startupPowerUserHome/backgroundConnect: +64%
  • startupPowerUserHome/numNetworkReqs: +13%
  • startupStandardHome/uiStartup: -14%
  • startupStandardHome/load: -13%
  • startupStandardHome/domContentLoaded: -13%
  • startupStandardHome/backgroundConnect: -36%
  • startupStandardHome/firstReactRender: -20%
  • startupStandardHome/loadScripts: -13%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -24%
  • startupPowerUserHome/numNetworkReqs: +19%
  • startupStandardHome/domInteractive: -57%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/setupStore: +21%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/backgroundConnect: -21%
  • startupStandardHome/domInteractive: -36%
  • startupStandardHome/backgroundConnect: -19%
  • startupStandardHome/initialActions: +11%
  • startupStandardHome/setupStore: -57%
  • startupStandardHome/numNetworkReqs: -13%
  • startupPowerUserHome/backgroundConnect: -20%
  • startupPowerUserHome/setupStore: -25%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🔴 startupPowerUserHome/INP: p75 592ms
  • 🔴 startupPowerUserHome/INP: p75 656ms
  • 🟡 startupPowerUserHome/LCP: p75 3.6s
  • 🟡 startupPowerUserHome/LCP: p75 3.7s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/doneButtonToHomeScreen: -71%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +23%
  • onboardingImportWallet/total: -37%
  • onboardingNewWallet/skipBackupToMetricsScreen: -15%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -25%
  • onboardingNewWallet/doneButtonToAssetList: -44%
  • onboardingNewWallet/total: -37%
  • assetDetails/assetClickToPriceChart: -65%
  • assetDetails/total: -65%
  • solanaAssetDetails/assetClickToPriceChart: -33%
  • solanaAssetDetails/total: -33%
  • importSrpHome/openAccountMenuAfterLogin: -75%
  • importSrpHome/homeAfterImportWithNewWallet: -37%
  • importSrpHome/total: -31%
  • sendTransactions/openSendPageFromHome: +97%
  • sendTransactions/selectTokenToSendFormLoaded: -21%
  • swap/openSwapPageFromHome: -88%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +14%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/INP: p75 208ms
  • 🟡 assetDetails/FCP: p75 2.5s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 208ms
  • 🟡 importSrpHome/FCP: p75 2.5s
  • 🟡 sendTransactions/INP: p75 208ms
  • 🟡 sendTransactions/FCP: p75 2.4s
  • 🟡 swap/FCP: p75 2.5s
🌐 Dapp Page Load Benchmarks

Current Commit: 46822f7 | Date: 4/6/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±38ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 741ms (±35ms) 🟢 | historical mean value: 727ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 87ms (±11ms) 🟢 | historical mean value: 87ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 38ms 1.02s 1.33s 1.09s 1.33s
domContentLoaded 741ms 35ms 712ms 1.01s 759ms 1.01s
firstPaint 87ms 11ms 68ms 172ms 100ms 172ms
firstContentfulPaint 87ms 11ms 68ms 172ms 100ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 341 Bytes (0%)
  • common: 3.46 KiB (0.03%)

* Resets local connection state.
*/
destroy(): void {
this.connected = false;
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.

Nit: But I wonder if destroy should also call disconnect implicitly in-case the device is still connected (I know we're not doing that for the LedgerAdapter, but that might be something we should discuss internally cc @montelaidev)

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.

(not something we need to handle on this PR btw)

@@ -86,6 +87,7 @@ const ERROR_PROPERTIES_MAP = (() => {

// Extract from Ledger
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.

Nit: But given that we have more adapters now, this comment should be changed at some point

Comment on lines +34 to +37
if (globalThis.window === undefined) {
return false;
}
const { navigator } = globalThis;
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.

Just double-checking: Did you want to check .window only? Or also for .navigator?

Since navigator could effectively be undefined here when we use navigator.mediaDevices below.

(Not sure this object can ever be undefined, but I prefer to double-check with you!)

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.

But from what I read, navigator is similar to window.navigator anyway, so if window is defined, navigator should be available, we should be safe I think

video: true,
});

stream.getTracks().forEach((track) => track.stop());
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.

Nit: Just to make sure I understand, are we requesting + stopping everything, just to be able to request the camera permission only once?

Like we request, then queryCameraPermissionDomState() should already be set to the proper value so we know we can use it without asking again?

If yes, then having a comment could have been great!

Copy link
Copy Markdown
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

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

LGTM! Left some nits and potential questions about the HW adapter in general, but other than that, the code is good!

@david0xd david0xd added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit d1ca1cf Apr 7, 2026
391 of 394 checks passed
@david0xd david0xd deleted the dd/add-qr-adapter branch April 7, 2026 11:19
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2026
@metamaskbot metamaskbot added the release-13.27.0 Issue or pull request that will be included in release 13.27.0 label Apr 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.27.0 Issue or pull request that will be included in release 13.27.0 size-L team-accounts-framework Accounts team team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants