Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable unsupported swap+send networks (#25474)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Swap+Send relies on a function in the newest swap+send contracts (i.e. once Swap+Send is deployed on all current swap networks, Swap+Send network support should be 1-to-1 with that of Swaps). However, we are still waiting on the API to be updated for these new contracts so we cannot operate under the assumption that all of these networks will be deployed by the time Swap+Send begins rolling out in production. To mitigate this concern, we can utilize a property in Swaps' feature flag endpoint (see: https://swap.dev-api.cx.metamask.io/featureFlags) when the send flow is initialized to determine if that network should be disabled despite having swaps support. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25474?quickstart=1) ## **Related issues** Fixes: #25107 ## **Manual testing steps** 1. Set `SWAPS_USE_DEV_APIS=true` in `.metamaskrc` (the endpoint update hasn't been deployed to prod as of writing) 2. Switch to an unsupported network (e.g., zkSync) 3. Verify that, when entering the swaps flow, that network is disabled (i.e., the destination asset picker is disabled) 4. Switch to a supported network (e.g., BNB) 5. Verify that the network is not disabled in the send flow ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** #### zkSync (network enabled despite no support) <img width="405" alt="Screenshot 2024-06-21 at 2 01 27 PM" src="https://github.com/MetaMask/metamask-extension/assets/44588480/fbbac5d5-860f-49a4-9bf3-1f4722a975f0"> #### BNB (network enabled) <img width="405" alt="Screenshot 2024-06-21 at 2 00 48 PM" src="https://github.com/MetaMask/metamask-extension/assets/44588480/06fbc608-829e-443f-80d2-8bd4e152843c"> <!-- [screenshots/recordings] --> ### **After** #### zkSync (network disabled) <img width="405" alt="Screenshot 2024-06-21 at 1 59 48 PM" src="https://github.com/MetaMask/metamask-extension/assets/44588480/7910a56c-3744-4aef-9964-085c83f6c391"> #### BNB (network enabled) <img width="405" alt="Screenshot 2024-06-21 at 2 00 11 PM" src="https://github.com/MetaMask/metamask-extension/assets/44588480/e3fd781f-e3f0-4e7d-bc1b-ed3cc2148dc8"> <!-- [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