Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (10 files, +632 -0)
|
bd61c26 to
51fcdfa
Compare
Builds ready [51fcdfa]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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.
Reviewed by Cursor Bugbot for commit 69ff639. Configure here.
Builds ready [69ff639]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [2d502fa]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [19b9d1f]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
Builds ready [46822f7]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| * Resets local connection state. | ||
| */ | ||
| destroy(): void { | ||
| this.connected = false; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
(not something we need to handle on this PR btw)
| @@ -86,6 +87,7 @@ const ERROR_PROPERTIES_MAP = (() => { | |||
|
|
|||
| // Extract from Ledger | |||
There was a problem hiding this comment.
Nit: But given that we have more adapters now, this comment should be changed at some point
| if (globalThis.window === undefined) { | ||
| return false; | ||
| } | ||
| const { navigator } = globalThis; |
There was a problem hiding this comment.
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!)
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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!
ccharly
left a comment
There was a problem hiding this comment.
LGTM! Left some nits and potential questions about the HW adapter in general, but other than that, the code is good!




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
Note
Medium Risk
Introduces a new
QrAdapterand adds camera permission probing/requesting to sharedwebConnectionUtils, 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
QrAdapterthat manages QR-flow connection state and gatesensureDeviceReadyon browser camera permission, emitting mapped device events/errors for denied/prompt/unknown cases.Extends
webConnectionUtilsto support camera availability checks, camera permission probing (checkCameraPermission/checkCameraPermissionState), and camera permission requests (requestCameraPermission), and wires these intocheckHardwareWalletPermission/requestHardwareWalletPermissionforHardwareWalletType.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.