Skip to content

Commit a123783

Browse files
khanti42bergarcesGudahtt
authored
fix: sei and mon native token swap selection (#38349)
<!-- 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** <!-- 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? --> This PR applies a Yarn patch to @metamask/bridge-controller@61.0.0 to correctly register the MONAD (143) and SEI (1329) chain IDs in the ChainId enum. This resolves a UI bug where swap fields incorrectly default to BTC or ETH instead of MON/SEI when all “Popular Networks” are enabled. The bridge-controller’s internal enumerations for numerical chain Ids did not include MONAD nor SEI (chain ID 143). When the app attempted to determine the appropriate chain, this caused fallback behavior, leading to incorrect mappings (defaulting to BTC/ETH). Fix - Introduce a Yarn patch that adds: - ChainId.SEI = 1329 - ChainId.MONAD = 143 - Update package.json and yarn.lock to use the patched controller. - No functional logic changes; only enum correction to ensure proper chain resolution. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38349?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Fixed a bug where swapping from the Mon token page suggested ETH instead of MON when all Popular Networks were enabled. Added missing MONAD (143) and SEI (1329) chain IDs to the bridge-controller to ensure correct chain resolution. ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/ea8b3df0-c9b1-462e-b6b5-4a96f22493a3 ### **After** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/15566568-1a08-46bb-87f7-be739a9c5079 ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Registers SEI and MONAD chain IDs in `@metamask/bridge-controller@61.0.0` via a Yarn patch and updates dependencies to use the patched package. > > - **Bridge Controller patch**: > - Adds `ChainId.SEI = 1329` and `ChainId.MONAD = 143` in `dist/types.cjs` via `/.yarn/patches/@metamask-bridge-controller-npm-61.0.0-8c413c463f.patch`. > - **Dependencies**: > - Points `package.json` and `yarn.lock` to the patched `@metamask/bridge-controller@61.0.0`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f04cda3. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Bernardo Garces Chapero <bernardo.chapero@consensys.net> Co-authored-by: Mark Stacey <mark.stacey@consensys.net>
1 parent 7964998 commit a123783

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/dist/types.cjs b/dist/types.cjs
2+
index a83a797b8f01747a6d51eb1219669c729955f039..ea9eb54bf3a0ae7ed3c75a8bb9904dd925a50a16 100644
3+
--- a/dist/types.cjs
4+
+++ b/dist/types.cjs
5+
@@ -47,6 +47,8 @@ var ChainId;
6+
ChainId[ChainId["SOLANA"] = 1151111081099710] = "SOLANA";
7+
ChainId[ChainId["BTC"] = 20000000000001] = "BTC";
8+
ChainId[ChainId["TRON"] = 728126428] = "TRON";
9+
+ ChainId[ChainId["SEI"] = 1329] = "SEI";
10+
+ ChainId[ChainId["MONAD"] = 143] = "MONAD";
11+
})(ChainId || (exports.ChainId = ChainId = {}));
12+
var RequestStatus;
13+
(function (RequestStatus) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
"@metamask/assets-controllers": "patch:@metamask/assets-controllers@patch%3A@metamask/assets-controllers@npm%253A89.0.1%23~/.yarn/patches/@metamask-assets-controllers-npm-89.0.1-02fa7acd54.patch%3A%3Aversion=89.0.1&hash=6be0d3#~/.yarn/patches/@metamask-assets-controllers-patch-7c7d711c8c.patch",
278278
"@metamask/base-controller": "^9.0.0",
279279
"@metamask/bitcoin-wallet-snap": "^1.7.0",
280-
"@metamask/bridge-controller": "^61.0.0",
280+
"@metamask/bridge-controller": "patch:@metamask/bridge-controller@npm%3A61.0.0#~/.yarn/patches/@metamask-bridge-controller-npm-61.0.0-8c413c463f.patch",
281281
"@metamask/bridge-status-controller": "^61.0.0",
282282
"@metamask/browser-passworder": "^4.3.0",
283283
"@metamask/chain-agnostic-permission": "^1.2.2",

yarn.lock

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,7 +5887,7 @@ __metadata:
58875887
languageName: node
58885888
linkType: hard
58895889

5890-
"@metamask/bridge-controller@npm:^61.0.0":
5890+
"@metamask/bridge-controller@npm:61.0.0":
58915891
version: 61.0.0
58925892
resolution: "@metamask/bridge-controller@npm:61.0.0"
58935893
dependencies:
@@ -5919,6 +5919,38 @@ __metadata:
59195919
languageName: node
59205920
linkType: hard
59215921

5922+
"@metamask/bridge-controller@patch:@metamask/bridge-controller@npm%3A61.0.0#~/.yarn/patches/@metamask-bridge-controller-npm-61.0.0-8c413c463f.patch":
5923+
version: 61.0.0
5924+
resolution: "@metamask/bridge-controller@patch:@metamask/bridge-controller@npm%3A61.0.0#~/.yarn/patches/@metamask-bridge-controller-npm-61.0.0-8c413c463f.patch::version=61.0.0&hash=f88d28"
5925+
dependencies:
5926+
"@ethersproject/address": "npm:^5.7.0"
5927+
"@ethersproject/bignumber": "npm:^5.7.0"
5928+
"@ethersproject/constants": "npm:^5.7.0"
5929+
"@ethersproject/contracts": "npm:^5.7.0"
5930+
"@ethersproject/providers": "npm:^5.7.0"
5931+
"@metamask/base-controller": "npm:^9.0.0"
5932+
"@metamask/controller-utils": "npm:^11.15.0"
5933+
"@metamask/gas-fee-controller": "npm:^25.0.0"
5934+
"@metamask/keyring-api": "npm:^21.0.0"
5935+
"@metamask/messenger": "npm:^0.3.0"
5936+
"@metamask/metamask-eth-abis": "npm:^3.1.1"
5937+
"@metamask/multichain-network-controller": "npm:^2.0.0"
5938+
"@metamask/polling-controller": "npm:^15.0.0"
5939+
"@metamask/utils": "npm:^11.8.1"
5940+
bignumber.js: "npm:^9.1.2"
5941+
reselect: "npm:^5.1.1"
5942+
uuid: "npm:^8.3.2"
5943+
peerDependencies:
5944+
"@metamask/accounts-controller": ^34.0.0
5945+
"@metamask/assets-controllers": ^89.0.0
5946+
"@metamask/network-controller": ^25.0.0
5947+
"@metamask/remote-feature-flag-controller": ^2.0.0
5948+
"@metamask/snaps-controllers": ^14.0.0
5949+
"@metamask/transaction-controller": ^61.0.0
5950+
checksum: 10/8ad4ed2d6cbfa09aa42394b6c61a97fec9401fd3d26f6f90c8f4d0afd9f736f2eef45c5f71be6baf009f008a51452badb32aee38c029bb0a905792f6da84afe5
5951+
languageName: node
5952+
linkType: hard
5953+
59225954
"@metamask/bridge-status-controller@npm:^61.0.0":
59235955
version: 61.0.0
59245956
resolution: "@metamask/bridge-status-controller@npm:61.0.0"
@@ -32791,7 +32823,7 @@ __metadata:
3279132823
"@metamask/auto-changelog": "npm:^5.1.0"
3279232824
"@metamask/base-controller": "npm:^9.0.0"
3279332825
"@metamask/bitcoin-wallet-snap": "npm:^1.7.0"
32794-
"@metamask/bridge-controller": "npm:^61.0.0"
32826+
"@metamask/bridge-controller": "patch:@metamask/bridge-controller@npm%3A61.0.0#~/.yarn/patches/@metamask-bridge-controller-npm-61.0.0-8c413c463f.patch"
3279532827
"@metamask/bridge-status-controller": "npm:^61.0.0"
3279632828
"@metamask/browser-passworder": "npm:^4.3.0"
3279732829
"@metamask/build-utils": "npm:^3.0.0"

0 commit comments

Comments
 (0)