Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add error handling for
setCorrectChain
(#28740)
## **Description** Adds error handling to `setCurrentNetwork` and additional check to make sure that the user is never redirected to an incorrect network that is incompatible with the token they are trying to send/swap. This is an edge case, and should be revisited post-launch for a more elegant/user friendly approach. We are now checking to make sure that the network and token chainIds match before redirecting. Very rarely, this will result in the user needing to click the send/swap button twice before they get redirected to the send/swap flow. In our opinion, this was preferable to potentially redirecting the user to an incorrect network, where they could transact with a token incompatible with the network they are on. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28740?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** ## **Screenshots/Recordings** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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