Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bug when requested accounts/chainIds do not match wallet state (#…
…29988) ## **Description** Fix bug when requested accounts/chainIds do not match wallet state [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29988?quickstart=1) ## **Manual testing steps** See videos below: ``` await window.ethereum.request({ "method": "wallet_requestPermissions", "params": [ { "eth_accounts": { "caveats": [ { "type": "restrictReturnedAccounts", "value": [] } ] }, "endowment:permitted-chains": { "caveats": [ { "type": "restrictNetworkSwitching", "value": ['0xbf04'] // any chainId not in the wallet } ] } } ], }); ``` ``` await window.ethereum.request({ "method": "wallet_requestPermissions", "params": [ { "eth_accounts": { "caveats": [ { "type": "restrictReturnedAccounts", "value": ["0x549f7D54F0a7ef67707c55dc51123586a2c6654e"] // any address not in the wallet } ] }, "endowment:permitted-chains": { "caveats": [ { "type": "restrictNetworkSwitching", "value": [] } ] } } ], }); ``` ## **Screenshots/Recordings** ### **Before** https://github.com/user-attachments/assets/21f40a75-0513-4105-8f8a-f87faf2a583c https://github.com/user-attachments/assets/d8e71869-5181-4751-a274-8e39cc8ec567 ### **After** https://github.com/user-attachments/assets/4f33ca41-657b-4902-b998-70c8c222484a https://github.com/user-attachments/assets/d8059e25-2772-4aef-8d26-e6b6325788ac https://github.com/user-attachments/assets/a67517c7-498f-485a-a547-59d330d9f0a8 ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). 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. --------- Co-authored-by: ffmcgee <[email protected]> Co-authored-by: ffmcgee <[email protected]> Co-authored-by: ffmcgee <[email protected]>
- Loading branch information