Skip to content

Conversation

@khanti42
Copy link
Contributor

@khanti42 khanti42 commented Nov 27, 2025

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

  • 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

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

  1. Go to this page...

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

  • 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.

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.

Written by Cursor Bugbot for commit f04cda3. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

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.

@metamaskbot
Copy link
Collaborator

Builds ready [47b5675]
UI Startup Metrics (1331 ± 132 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13311099169113214231554
load1067888132010511391246
domContentLoaded1060885131310311281240
domInteractive2715124222288
firstPaint55188124740610241191
backgroundConnect22219825714228251
firstReactRender392478114361
getState64181862972128
initialActions106124
loadScripts84567611011009081034
setupStore1364761627
numNetworkReqs4191473330140
BrowserifyPower User HomeuiStartup20731671293425122042558
load1026913150413510211405
domContentLoaded1010903149213610061398
domInteractive35172043231126
firstPaint6209715264079781323
backgroundConnect268203694118234603
firstReactRender5941126146394
getState19314369774199260
initialActions103112
loadScripts80069612891357981189
setupStore19103862328
numNetworkReqs1616639371200334
WebpackStandard HomeuiStartup8437161143968631082
load62956584272652812
domContentLoaded62556183871640806
domInteractive26151202320103
firstPaint21189818140191625
backgroundConnect125175171129
firstReactRender37212122535105
getState4517117225693
initialActions104111
loadScripts62255982970638798
setupStore1364481439
numNetworkReqs41281493431142
WebpackPower User HomeuiStartup16481266270525718882099
load6805811236105684955
domContentLoaded6705751228106672949
domInteractive38171923534131
firstPaint310921237220388692
backgroundConnect67757914819527
firstReactRender634510096878
getState18114266769179212
initialActions103112
loadScripts6675731219104669939
setupStore20753102243
numNetworkReqs1646740078206371
FirefoxBrowserifyStandard HomeuiStartup13851132181815815001711
load106591413119011251255
domContentLoaded106591413119011251255
domInteractive55311883273127
firstPaint------
backgroundConnect61223324467150
firstReactRender281971113252
getState269217252378
initialActions209122
loadScripts103589812528110811226
setupStore247113182368
numNetworkReqs39281302632117
BrowserifyPower User HomeuiStartup26681942392443028463658
load1206989184217212471595
domContentLoaded1205989184217212471595
domInteractive13436664120125466
firstPaint------
backgroundConnect13824699117143424
firstReactRender64381221970106
getState27555831194371794
initialActions2148523
loadScripts1170969177216612051532
setupStore209101041233257765
numNetworkReqs102603226380243
WebpackStandard HomeuiStartup17071403234819218072115
load13421108182512213931576
domContentLoaded13411108182512213931576
domInteractive732818940101161
firstPaint------
backgroundConnect75263254884187
firstReactRender31227293346
getState267149232361
initialActions203123
loadScripts13051091174010913601530
setupStore2511134222385
numNetworkReqs40291282537121
WebpackPower User HomeuiStartup30202258530869131784763
load14691182284834815462639
domContentLoaded14691182284834815462639
domInteractive11832499111103441
firstPaint------
backgroundConnect154331618215144423
firstReactRender66401962269109
getState29575930229377812
initialActions203123
loadScripts13931130254024613991855
setupStore17371162246162735
numNetworkReqs101552575881240
📊 Page Load Benchmark Results

Current Commit: 47b5675 | Date: 11/27/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.12s (±83ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 768ms (±96ms) 🟢 | historical mean value: 723ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 98ms (±135ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.12s 83ms 1.06s 1.48s 1.37s 1.48s
domContentLoaded 768ms 96ms 714ms 1.37s 1.01s 1.37s
firstPaint 98ms 135ms 72ms 1.44s 100ms 1.44s
firstContentfulPaint 98ms 135ms 72ms 1.44s 100ms 1.44s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 174 Bytes (0%)

@khanti42 khanti42 marked this pull request as ready for review November 27, 2025 12:51
@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Nov 27, 2025
+ ChainId[ChainId["MONAD"] = 143] = "MONAD";
})(ChainId || (exports.ChainId = ChainId = {}));
var RequestStatus;
(function (RequestStatus) {
Copy link

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.

Fix in Cursor Fix in Web

infiniteflower
infiniteflower previously approved these changes Nov 27, 2025
@khanti42 khanti42 moved this from Needs dev review to Has approvals, needs CODEOWNER in PR review queue Nov 27, 2025
bergarces and others added 4 commits November 27, 2025 13:34
Co-authored-by: Mark Stacey <mark.stacey@consensys.net>
wantedsystem
wantedsystem previously approved these changes Nov 27, 2025
@github-project-automation github-project-automation bot moved this from Has approvals, needs CODEOWNER to Review finalised - Ready to be merged in PR review queue Nov 27, 2025
@khanti42 khanti42 enabled auto-merge November 27, 2025 15:53
@khanti42 khanti42 disabled auto-merge November 27, 2025 15:57
@khanti42 khanti42 dismissed stale reviews from wantedsystem and infiniteflower via 7e97b5e November 27, 2025 16:00
@khanti42 khanti42 requested a review from a team as a code owner November 27, 2025 16:00
+ ChainId[ChainId["MONAD"] = 143] = "MONAD";
})(ChainId || (exports.ChainId = ChainId = {}));
var RequestStatus;
(function (RequestStatus) {
Copy link

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.

Fix in Cursor Fix in Web

@metamaskbot
Copy link
Collaborator

Builds ready [7e97b5e]
UI Startup Metrics (1290 ± 105 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12901063160610513551486
load104586713888811051194
domContentLoaded104086113798710991185
domInteractive261699202182
firstPaint53484121339910171123
backgroundConnect21519829613221237
firstReactRender382466104361
getState57201692766124
initialActions106113
loadScripts830663115786885985
setupStore1473761727
numNetworkReqs41281503330143
BrowserifyPower User HomeuiStartup20981662317324822652522
load1017887174013610141353
domContentLoaded100288017131359961345
domInteractive37172253238122
firstPaint53111313573769471234
backgroundConnect262198762118231612
firstReactRender5639111116077
getState19914767888203267
initialActions103112
loadScripts79567315081357841147
setupStore20105182338
numNetworkReqs1636638768199322
WebpackStandard HomeuiStartup90076111831029101144
load65958188674667846
domContentLoaded65357787873663840
domInteractive2816150242395
firstPaint24188716164220653
backgroundConnect1164471231
firstReactRender4220237313999
getState56151162774104
initialActions105113
loadScripts65057586872661831
setupStore184310331543
numNetworkReqs41281453331142
WebpackPower User HomeuiStartup17051291227925719562156
load681591102597678958
domContentLoaded671584101598666940
domInteractive39181993733150
firstPaint24890920162247661
backgroundConnect109860219427564
firstReactRender644795107085
getState18012668474180212
initialActions104112
loadScripts668582100496664931
setupStore241056133151
numNetworkReqs1656841183214387
FirefoxBrowserifyStandard HomeuiStartup14911209212119215911869
load1125965141810711941352
domContentLoaded1125959141810711941352
domInteractive70322464195150
firstPaint------
backgroundConnect68332164192160
firstReactRender302077113461
getState2511130182466
initialActions205123
loadScripts1095946139110211571331
setupStore3013239303194
numNetworkReqs39281222534118
BrowserifyPower User HomeuiStartup26232026461942927353596
load1166976180416911541595
domContentLoaded1166976180316911541595
domInteractive13037684127111486
firstPaint------
backgroundConnect13538902128130462
firstReactRender60381511862100
getState315741128245411830
initialActions207126
loadScripts1128954171816211121566
setupStore19410780203267657
numNetworkReqs100623146177236
WebpackStandard HomeuiStartup17021379243020117852156
load13241138165712914161608
domContentLoaded13231138165712914111608
domInteractive76283315093192
firstPaint------
backgroundConnect73312693981150
firstReactRender31226383549
getState2891502526113
initialActions208123
loadScripts12921114162212213771532
setupStore27112633521107
numNetworkReqs40291282737121
WebpackPower User HomeuiStartup30362302563567432034552
load14751186281534315662584
domContentLoaded14751186281534315662584
domInteractive11532535116102472
firstPaint------
backgroundConnect158261019170164381
firstReactRender66422562867109
getState308471275252378788
initialActions203123
loadScripts14291123264831915122455
setupStore15971107212163744
numNetworkReqs101612495981238
📊 Page Load Benchmark Results

Current Commit: 7e97b5e | Date: 11/27/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±70ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 732ms (±67ms) 🟢 | historical mean value: 723ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±12ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 70ms 1.01s 1.32s 1.25s 1.32s
domContentLoaded 732ms 67ms 699ms 992ms 935ms 992ms
firstPaint 76ms 12ms 60ms 184ms 88ms 184ms
firstContentfulPaint 76ms 12ms 60ms 184ms 88ms 184ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 174 Bytes (0%)

+ ChainId[ChainId["MONAD"] = 143] = "MONAD";
})(ChainId || (exports.ChainId = ChainId = {}));
var RequestStatus;
(function (RequestStatus) {
Copy link

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.

Fix in Cursor Fix in Web

@metamaskbot
Copy link
Collaborator

Builds ready [9625185]
UI Startup Metrics (1205 ± 108 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12051014154110812731407
load101586613409710531228
domContentLoaded101085913329710501222
domInteractive2514105192084
firstPaint4718312883809621124
backgroundConnect21118927713216236
firstReactRender312059103653
getState3516136173963
initialActions109112
loadScripts8046521062928451006
setupStore1162641219
numNetworkReqs1257620574
BrowserifyPower User HomeuiStartup21451826286626123362741
load1030908154112810361382
domContentLoaded1014902153212810221372
domInteractive36181412637122
firstPaint51611415513969741340
backgroundConnect25620468895232532
firstReactRender60401251664108
getState19313767859208264
initialActions103112
loadScripts80568413191288061164
setupStore2287692540
numNetworkReqs1606839567196336
WebpackStandard HomeuiStartup797667114593864968
load61854195681647792
domContentLoaded61353794679641785
domInteractive241495192081
firstPaint27096925202267728
backgroundConnect11586101126
firstReactRender26194263139
getState241257103343
initialActions102111
loadScripts61053594478638777
setupStore1061831216
numNetworkReqs1257821576
WebpackPower User HomeuiStartup16501259242826319472142
load6775881101100674951
domContentLoaded6675811094101665945
domInteractive36181513133131
firstPaint27097966175265667
backgroundConnect71967215820565
firstReactRender60448386577
getState18513867972187227
initialActions105112
loadScripts664579108599663937
setupStore211054132352
numNetworkReqs1666940780210384
FirefoxBrowserifyStandard HomeuiStartup12731045166414213561596
load1053902144510411061302
domContentLoaded1052902144510411061302
domInteractive59311863384121
firstPaint------
backgroundConnect46212023158103
firstReactRender23175672441
getState1063041021
initialActions102012
loadScripts102488513709510671266
setupStore12612416928
numNetworkReqs1157316656
BrowserifyPower User HomeuiStartup26361933429953427523984
load1166980245819911661552
domContentLoaded1165980245719911661552
domInteractive11533492104111402
firstPaint------
backgroundConnect10725881115101275
firstReactRender59381181862101
getState27567876217321806
initialActions2140423
loadScripts1135965231218811281530
setupStore1608746183219597
numNetworkReqs99572915883239
WebpackStandard HomeuiStartup15031273214415515981792
load12421082161010213091435
domContentLoaded12421082161010213091435
domInteractive57271953082104
firstPaint------
backgroundConnect48212453252104
firstReactRender26208772733
getState177253351280
initialActions104112
loadScripts1213106415839312751361
setupStore195195341283
numNetworkReqs1157115753
WebpackPower User HomeuiStartup29292044495366432334445
load14421166262034115742473
domContentLoaded14421166262034115732472
domInteractive11733600120100466
firstPaint------
backgroundConnect144301192180138452
firstReactRender65391912667121
getState268731054225359789
initialActions3161827
loadScripts13711136247629314052313
setupStore15851029218187722
numNetworkReqs1016025557112246
📊 Page Load Benchmark Results

Current Commit: 9625185 | Date: 11/27/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 980ms (±69ms) 🟢 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 686ms (±65ms) 🟢 | historical mean value: 721ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 74ms (±10ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 980ms 69ms 938ms 1.26s 1.20s 1.26s
domContentLoaded 686ms 65ms 650ms 950ms 890ms 950ms
firstPaint 74ms 10ms 64ms 168ms 80ms 168ms
firstContentfulPaint 74ms 10ms 64ms 168ms 80ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 174 Bytes (0%)

@khanti42 khanti42 enabled auto-merge November 27, 2025 20:56
@metamaskbot
Copy link
Collaborator

Builds ready [f04cda3]
UI Startup Metrics (1208 ± 94 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1208101114499412701375
load101184712228510561187
domContentLoaded100584312178410481181
domInteractive2514117192074
firstPaint5238412223999881141
backgroundConnect21319325213222238
firstReactRender30185693550
getState3616149223979
initialActions103113
loadScripts79764998582838967
setupStore1153651220
numNetworkReqs1257720572
BrowserifyPower User HomeuiStartup20941783278124722462636
load1019893153713510151392
domContentLoaded100588215261359951382
domInteractive35181432832115
firstPaint5418715443939611221
backgroundConnect25020364296229542
firstReactRender64401271870110
getState18514072561192232
initialActions1012213
loadScripts79968113261367861185
setupStore2176192441
numNetworkReqs1336932767195276
WebpackStandard HomeuiStartup8437141112808711011
load64857588063666807
domContentLoaded64357287362662801
domInteractive2815166252394
firstPaint20590780127203633
backgroundConnect1255181329
firstReactRender2820104103241
getState271360113448
initialActions102112
loadScripts64057086460659789
setupStore1163341217
numNetworkReqs1257721574
WebpackPower User HomeuiStartup17121379278026819382229
load6915951342111683954
domContentLoaded6815871319111673946
domInteractive38181913536139
firstPaint297861354213346678
backgroundConnect105761218539554
firstReactRender634597106885
getState17214123417182205
initialActions104112
loadScripts6785851309109670936
setupStore21665102446
numNetworkReqs1697040876211363
FirefoxBrowserifyStandard HomeuiStartup12821086185113413601512
load105692712858711211223
domContentLoaded105592712858711211223
domInteractive60301663281124
firstPaint------
backgroundConnect45212403444117
firstReactRender22185552334
getState157225251156
initialActions102012
loadScripts102791212207910821190
setupStore126118131029
numNetworkReqs1156415755
BrowserifyPower User HomeuiStartup26261891476445527963566
load11951017201618411751669
domContentLoaded11941016201518411751669
domInteractive13437801136112503
firstPaint------
backgroundConnect131331020136131413
firstReactRender62401511965103
getState26462966209270776
initialActions2130324
loadScripts1147991174415711441533
setupStore1618749179202635
numNetworkReqs101643156079237
WebpackStandard HomeuiStartup15151262191315616121864
load12491064156310513281457
domContentLoaded12481063156310513281457
domInteractive64262003686133
firstPaint------
backgroundConnect48182013346127
firstReactRender28208092941
getState156187231432
initialActions103122
loadScripts1220104715399912991410
setupStore145134191147
numNetworkReqs1156615755
WebpackPower User HomeuiStartup29452006754288030344717
load14831109580156915152637
domContentLoaded14821109580156915152637
domInteractive150304017405104459
firstPaint------
backgroundConnect1832812392571431005
firstReactRender64382173063142
getState283561031238400848
initialActions3090923
loadScripts13831086577750714421845
setupStore1145639159110553
numNetworkReqs1026225151127241
📊 Page Load Benchmark Results

Current Commit: f04cda3 | Date: 11/27/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±72ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 741ms (±69ms) 🟢 | historical mean value: 724ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±12ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 72ms 1.02s 1.36s 1.27s 1.36s
domContentLoaded 741ms 69ms 704ms 1.02s 947ms 1.02s
firstPaint 78ms 12ms 64ms 188ms 92ms 188ms
firstContentfulPaint 78ms 12ms 64ms 188ms 92ms 188ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 174 Bytes (0%)

@khanti42 khanti42 added this pull request to the merge queue Nov 27, 2025
Merged via the queue into main with commit a123783 Nov 27, 2025
176 checks passed
@khanti42 khanti42 deleted the fix/sei-mon-swap-native-selection branch November 27, 2025 22:03
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2025
@metamaskbot metamaskbot added the release-13.12.0 Issue or pull request that will be included in release 13.12.0 label Nov 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed release-13.12.0 Issue or pull request that will be included in release 13.12.0 size-S team-network-enablement

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants