-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: issue where wallet_addEtherumChain
was incorrectly enforcing inclusion of a blockExplorerUrls property which is not required
#26938
Conversation
…usion of a blockExplorerUrls property which is not required
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. |
looks good, spec also says it shouldn't be required: https://github.com/MetaMask/api-specs/blob/main/openrpc.yaml#L896-L900 |
@@ -120,7 +120,7 @@ export function validateAddEthereumChainParams(params, end) { | |||
|
|||
const firstValidRPCUrl = rpcUrls.find((rpcUrl) => isLocalhostOrHttps(rpcUrl)); | |||
const firstValidBlockExplorerUrl = | |||
blockExplorerUrls !== null && Array.isArray(blockExplorerUrls) | |||
blockExplorerUrls && Array.isArray(blockExplorerUrls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> Array.isArray(null)
false
> Array.isArray(undefined)
false
> Array.isArray(undefined)
false
> Array.isArray('')
false
> Array.isArray([])
true
Does the first part of the check need to be there in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we can scrap it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done here cb9d89e
@@ -120,6 +120,35 @@ describe('addEthereumChainHandler', () => { | |||
expect(mocks.setActiveNetwork).toHaveBeenCalledWith(123); | |||
}); | |||
|
|||
it('creates a new networkConfiguration when called with no "blockExplorerUrls" property', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('creates a new networkConfiguration when called with no "blockExplorerUrls" property', async () => { | |
it('creates a new networkConfiguration when called without "blockExplorerUrls" property', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit of course
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done here cb9d89e
cb9d89e
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #26938 +/- ##
========================================
Coverage 70.17% 70.17%
========================================
Files 1425 1425
Lines 49646 49644 -2
Branches 13891 13889 -2
========================================
Hits 34835 34835
+ Misses 14811 14809 -2 ☔ View full report in Codecov by Sentry. |
Builds ready [cb9d89e]
Page Load Metrics (1752 ± 65 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Missing release label release-12.2.0 on PR. Adding release label release-12.2.0 on PR and removing other release labels(release-12.6.0), as PR was cherry-picked in branch 12.2.0. |
Fix issue where
wallet_addEtherumChain
was incorrectly enforcing inclusion of a blockExplorerUrls property which is not requiredDescription
Related issues
Fixes: #26844
Manual testing steps
Screenshots/Recordings
Before
Screen.Recording.2024-09-05.at.9.53.27.AM.mov
After
Screen.Recording.2024-09-05.at.9.48.34.AM.mov
Pre-merge author checklist
Pre-merge reviewer checklist