You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently when running this request on main branch, the bad thing here being that we are requesting permitted chain that we don't have added on the extension, we get this error on UI (see image below).
Desired behaviour is what we have on current latest build, where running the same exact request with the chain we don't have added, throws a proper error in the console and no prompt in the UI
{
"code": -32603,
"message": "endowment:permitted-chains error: Received unrecognized chainId: \"0xa86a\". Please try adding the network first via wallet_addEthereumChain.",
"data": {
"cause": {
"stack": "Error: endowment:permitted-chains error: Received unrecognized chainId: \"0xa86a\". Please try adding the network first via wallet_addEthereumChain.\n at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-4.js:1:419383\n at Array.forEach (<anonymous>)\n at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-4.js:1:419329\n at Object.validator (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-4.js:1:419532)\n at j.validateCaveat (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-2.js:1:10699)\n at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-2.js:1:9684\n at Array.forEach (<anonymous>)\n at j.validatePermission (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-2.js:1:9660)\n at j.validateRequestedPermissions (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-2.js:1:12496)\n at j.requestPermissions (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-2.js:1:10822)\n at requestPermissionsForOrigin (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background-0.js:1:243117)\n at implementation (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-2.js:1:30815)\n at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background-7.js:1:173218\n at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-1.js:1:20623\n at new Promise (<anonymous>)\n at _.p (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-1.js:1:20280)\n at _.m (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-1.js:1:20198)\n at async _.d (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-1.js:1:19999)\n at async _.l (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/common-1.js:1:19825)",
"message": "endowment:permitted-chains error: Received unrecognized chainId: \"0xa86a\". Please try adding the network first via wallet_addEthereumChain."
}
}
}
This pull request fixes this issue.
Description
Related issues
Fixes:
Manual testing steps
Send the request shown on description
If chain is not configured in wallet, exception should be thrown in console
I've completed the PR template to the best of my ability
I’ve included tests if applicable
I’ve documented my code using JSDoc format if applicable
I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
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.
Desired behaviour is what we have on current latest build, where running the same exact request with the chain we don't have added, throws a proper error in the console and no prompt in the UI
I believe the endowment:permitted-chains error: Received unrecognized chainId: error is occurring because the chainId in the original request is still component state and is making it into the approveChainIds result even though it does not show up in the checkboxes. IMO, it is the responsibility of the UI here to properly handle the case where it gets passed chainIds that the wallet does not have. I don't believe that we need the validation/filtering logic at the handler level. Thoughts, @adonesky1 ?
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently when running this request on
main
branch, the bad thing here being that we are requesting permitted chain that we don't have added on the extension, we get this error on UI (see image below).Desired behaviour is what we have on current latest build, where running the same exact request with the chain we don't have added, throws a proper error in the console and no prompt in the UI
This pull request fixes this issue.
Description
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2025-01-27.at.20.39.12.mov
Pre-merge author checklist
Pre-merge reviewer checklist