-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: sei and mon native token swap selection #38349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [47b5675]
UI Startup Metrics (1331 ± 132 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| + ChainId[ChainId["MONAD"] = 143] = "MONAD"; | ||
| })(ChainId || (exports.ChainId = ChainId = {})); | ||
| var RequestStatus; | ||
| (function (RequestStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Patch missing ESM version of ChainId enum
The patch only modifies dist/types.cjs (CommonJS) but likely needs to also patch dist/types.mjs (ES Modules). Other patches in this repository (e.g., @metamask-assets-controllers) patch both .cjs and .mjs files because MetaMask controller packages export both formats. If the build system resolves the ESM version, the SEI and MONAD chain IDs won't be present in the ChainId enum, and the fix for the swap field defaulting issue may not work consistently.
Co-authored-by: Mark Stacey <mark.stacey@consensys.net>
…ei-mon-swap-native-selection
7e97b5e
| + ChainId[ChainId["MONAD"] = 143] = "MONAD"; | ||
| })(ChainId || (exports.ChainId = ChainId = {})); | ||
| var RequestStatus; | ||
| (function (RequestStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Patch may be incomplete, missing ESM file modification
The patch only modifies dist/types.cjs (CommonJS), but existing patches in this repository for other MetaMask controller packages (like @metamask-assets-controllers) follow a pattern of patching both .cjs and .mjs files. If @metamask/bridge-controller has dual exports (which is standard for MetaMask packages), the ESM version (types.mjs) won't include the SEI and MONAD chain IDs. This could cause the same bug to reappear in contexts that use ESM module resolution.
Builds ready [7e97b5e]
UI Startup Metrics (1290 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| + ChainId[ChainId["MONAD"] = 143] = "MONAD"; | ||
| })(ChainId || (exports.ChainId = ChainId = {})); | ||
| var RequestStatus; | ||
| (function (RequestStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Patch missing ESM file causing inconsistent ChainId enum
The patch only modifies dist/types.cjs (CommonJS) but likely needs to also patch dist/types.mjs (ES Module). Looking at similar patches in this codebase like @metamask-assets-controllers-npm-89.0.1-02fa7acd54.patch, MetaMask controller packages typically export both CJS and ESM formats, and both need patching for consistency. If only the CJS file is patched, code that imports via ESM bundling won't see the new SEI and MONAD chain IDs, potentially causing the fix to not work in certain module resolution contexts.
Builds ready [9625185]
UI Startup Metrics (1205 ± 108 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [f04cda3]
UI Startup Metrics (1208 ± 94 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
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
Changelog
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
Screenshots/Recordings
Before
Screen.Recording.2025-11-27.at.13.24.18.mov
After
Screen.Recording.2025-11-27.at.13.22.52.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Registers SEI and MONAD chain IDs in
@metamask/bridge-controller@61.0.0via a Yarn patch and updates dependencies to use the patched package.ChainId.SEI = 1329andChainId.MONAD = 143indist/types.cjsvia/.yarn/patches/@metamask-bridge-controller-npm-61.0.0-8c413c463f.patch.package.jsonandyarn.lockto the patched@metamask/bridge-controller@61.0.0.Written by Cursor Bugbot for commit f04cda3. This will update automatically on new commits. Configure here.