forked from MetaMask/metamask-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
wallet_switchEthereumChain
permission and enforce it (beh…
…ind feature flag) (MetaMask#24415) ## **Description** This PR introduces the `wallet_switchEthereumChain` permission (as an `endowment` type permission) behind a feature flag (`CHAIN_PERMISSIONS`), allowing us to remove the `wallet_switchEthereum` confirmation. Now instead of seeing this confirmation everytime `wallet_switchEthereumChain` is called for a given chain, users sees a confirmation to add a permission for the dapp to switch to this chain after which they will no longer see any confirmation at all when the dapp next attempts to switch to this chain. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24415?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#2327 ## **Manual testing steps** 1. `CHAIN_PERMISSIONS=1 yarn start` 2. Go to a dapp (uniswap is good for this test) and connect the wallet 3. Use the in dapp switch chain UI 4. You should see a permission confirmation (instead of the old switch chain confirmation) - The UI is not fully implemented, this will be completed by the `wallet-ux` team. 5. Manually switch to another chain in the wallet 6. Go back to the dapp and switch to the same chain you just added permissions for 7. You should not see any confirmation but the network should change ## **Screenshots/Recordings** ### **Before** https://github.com/MetaMask/metamask-extension/assets/34557516/6f6321ef-5fb5-48db-84a2-790cf178ea7f ### **After** https://github.com/MetaMask/metamask-extension/assets/34557516/c94c67be-f17d-4b9d-aec0-431ea89500f5 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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/develop/.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.
- Loading branch information
Showing
15 changed files
with
1,396 additions
and
529 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.