Skip to content

Conversation

@jpuri
Copy link
Contributor

@jpuri jpuri commented Nov 28, 2025

Description

Adding remote flag for dapp swap origins to make it configurable.

Changelog

CHANGELOG entry:

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6347

Manual testing steps

  1. submit swap requests
  2. check that dapp swap feature work as expected

Screenshots/Recordings

NA

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

Adds a configurable origin allowlist to dapp-swap and enforces it in middleware and UI rendering, replacing hardcoded origins and updating related context, hooks, and tests.

  • Dapp Swap middleware/util:
    • Extend dappSwapMetricsFlag to include origins: string[] and check origin membership before fetching quotes.
    • Remove hardcoded origins; pass flag through createDappSwapMiddleware/getQuotesForConfirmation.
    • Tests: add cases ensuring no fetch when origin not allowed; adjust existing tests to include origins.
  • UI hooks/components:
    • useDappSwapCheck: read dappSwapMetrics.enabled and origins from remote flags; require allowed origin and compatible type; remove hardcoded origins; add tests for enabled/origin/type cases.
    • DappSwapComparisonBanner: rely solely on useDappSwapCheck to render (remove separate flag check).
    • DappSwapContext: add isQuotedSwapPresent.
    • useDappSwapComparisonMetrics: use isQuotedSwapPresent to guard submit capture.
    • Tests updated to mock new hook/context behavior and expectations.

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

@jpuri jpuri requested a review from a team as a code owner November 28, 2025 13:22
@jpuri jpuri added team-confirmations Push issues to confirmations team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Nov 28, 2025
@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

metamaskbot commented Nov 28, 2025

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (8 files, +81 -26)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 components/
          • 📁 confirm/
            • 📁 dapp-swap-comparison-banner/
              • 📄 dapp-swap-comparison-banner.test.tsx +17 -8
              • 📄 dapp-swap-comparison-banner.tsx +1 -6
            • 📁 info/
              • 📁 base-transaction-info/
                • 📄 base-transaction-info.test.tsx +1 -0
              • 📁 hooks/
                • 📄 useFeeCalculations.test.ts +1 -0
        • 📁 context/
          • 📁 dapp-swap/
            • 📄 index.tsx +2 -0
        • 📁 hooks/
          • 📁 transactions/
            • 📁 dapp-swap-comparison/
              • 📄 useDappSwapCheck.test.ts +44 -4
              • 📄 useDappSwapCheck.ts +11 -5
              • 📄 useDappSwapComparisonMetrics.ts +4 -3

@jpuri jpuri enabled auto-merge November 28, 2025 13:46
@metamaskbot
Copy link
Collaborator

Builds ready [670b23f]
UI Startup Metrics (1246 ± 92 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1246104914399213191383
load103887612518310891188
domContentLoaded103387012408210851179
domInteractive261592192277
firstPaint51784126941310361163
backgroundConnect21919526615225255
firstReactRender332063103756
getState43181482547121
initialActions1014213
loadScripts819659103582867975
setupStore1262941421
numNetworkReqs1257520571
BrowserifyPower User HomeuiStartup20971731287428123292734
load1021876151614210131443
domContentLoaded100786715051429961433
domInteractive37171493035132
firstPaint49210215383689251021
backgroundConnect24020271679229446
firstReactRender5641111116079
getState19313969658207246
initialActions103112
loadScripts79967012951427871221
setupStore2086192342
numNetworkReqs1707041277212339
WebpackStandard HomeuiStartup87072312621019141076
load675585110592716832
domContentLoaded670579109891710826
domInteractive2916198272496
firstPaint25782842198223766
backgroundConnect1168091127
firstReactRender28205573341
getState25135793144
initialActions105112
loadScripts667576108790707816
setupStore1163051322
numNetworkReqs1257720573
WebpackPower User HomeuiStartup16511266239028419542107
load6705781226107680932
domContentLoaded6595721218108673924
domInteractive37171573234133
firstPaint302971229222369696
backgroundConnect53763313019478
firstReactRender604191116682
getState17512774359177195
initialActions103112
loadScripts6575701210106670915
setupStore21888132247
numNetworkReqs1706743085218412
FirefoxBrowserifyStandard HomeuiStartup12851052166914513711591
load1062904144510811211281
domContentLoaded1062904144510811211281
domInteractive58301172783107
firstPaint------
backgroundConnect43231472748102
firstReactRender24185982345
getState1064551021
initialActions103112
loadScripts103688813709610971246
setupStore1269515935
numNetworkReqs1156916662
BrowserifyPower User HomeuiStartup26841903468866428374275
load1247969265538212682472
domContentLoaded1247969265438212672472
domInteractive11734472103110407
firstPaint------
backgroundConnect1662211412481221004
firstReactRender61361422261126
getState279611027228394769
initialActions204123
loadScripts1172954259027912151577
setupStore1326799177132601
numNetworkReqs101522726181240
WebpackStandard HomeuiStartup15011260202613515721759
load1243106715609412941404
domContentLoaded1243106715599412941403
domInteractive62211733283112
firstPaint------
backgroundConnect49211813051114
firstReactRender28217283038
getState135113151327
initialActions103122
loadScripts1215105215288712721366
setupStore14691131341
numNetworkReqs1256616764
WebpackPower User HomeuiStartup29162092516074728544883
load14831180300745215742749
domContentLoaded14831180300745215742749
domInteractive12934107116898468
firstPaint------
backgroundConnect1882914622801581140
firstReactRender62421431864105
getState30179937233416794
initialActions2038425
loadScripts13841116298932814192339
setupStore1126605154105575
numNetworkReqs100632556079250
📊 Page Load Benchmark Results

Current Commit: 670b23f | Date: 11/28/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 717ms (±35ms) 🟢 | historical mean value: 725ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±14ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1000ms 1.32s 1.05s 1.32s
domContentLoaded 717ms 35ms 692ms 983ms 728ms 983ms
firstPaint 75ms 14ms 60ms 196ms 88ms 196ms
firstContentfulPaint 75ms 14ms 60ms 196ms 88ms 196ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 13 Bytes (0%)
  • ui: 397 Bytes (0.01%)
  • common: 20 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [77c2686]
UI Startup Metrics (1225 ± 96 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1225104615489612861372
load103086613759010761187
domContentLoaded102486113628810721183
domInteractive261498202185
firstPaint5008912503829871100
backgroundConnect21619326012222241
firstReactRender312167103752
getState3516135194064
initialActions104113
loadScripts815659114186854964
setupStore1173241319
numNetworkReqs1257420572
BrowserifyPower User HomeuiStartup19881619276028422292619
load95582614581439391365
domContentLoaded94082014381439231352
domInteractive31161242529103
firstPaint6749214663799141321
backgroundConnect22518072599205498
firstReactRender58381251762104
getState213137684116208625
initialActions104112
loadScripts75863812411387391159
setupStore1895581939
numNetworkReqs1566541978197342
WebpackStandard HomeuiStartup819692104376857990
load63255581869650796
domContentLoaded62755181469646791
domInteractive251491202187
firstPaint20279790127194576
backgroundConnect1053361026
firstReactRender2820107103038
getState251462103441
initialActions104111
loadScripts62554980568643782
setupStore1163451220
numNetworkReqs1257720572
WebpackPower User HomeuiStartup16881302250327819852138
load6795891240103673927
domContentLoaded6695841234104662919
domInteractive36181343033127
firstPaint287100948186323660
backgroundConnect76862916618577
firstReactRender6345107106783
getState18413170273185217
initialActions105112
loadScripts6665821224102660910
setupStore231073142554
numNetworkReqs1746542182216408
FirefoxBrowserifyStandard HomeuiStartup13631113198115314561656
load111895713929011901272
domContentLoaded111795613869011891271
domInteractive65321543186117
firstPaint------
backgroundConnect53242383970162
firstReactRender24196872436
getState1265981226
initialActions102022
loadScripts108694113658211471216
setupStore165184241160
numNetworkReqs1256817664
BrowserifyPower User HomeuiStartup26302048459955826424113
load1188913269630011871722
domContentLoaded1188913269630011871720
domInteractive11132631111105381
firstPaint------
backgroundConnect133261087181120347
firstReactRender5637115146093
getState315351042223440780
initialActions207123
loadScripts1131899260422111381527
setupStore1369728176124644
numNetworkReqs1006026255114244
WebpackStandard HomeuiStartup14741258188113915461766
load1212105714078912801384
domContentLoaded1211105714068912791384
domInteractive59251723383118
firstPaint------
backgroundConnect46171852845112
firstReactRender27208792940
getState167191251445
initialActions103122
loadScripts1187103813768512561334
setupStore146170211152
numNetworkReqs1157416759
WebpackPower User HomeuiStartup28912121524566829824318
load14561169280939214762457
domContentLoaded14561169280939214762457
domInteractive11331940128100379
firstPaint------
backgroundConnect155261036208132910
firstReactRender61411902762112
getState23879855186278700
initialActions401021124
loadScripts13931151266332214442333
setupStore1357919185132593
numNetworkReqs1005926055114239
📊 Page Load Benchmark Results

Current Commit: 77c2686 | Date: 11/28/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±40ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 733ms (±37ms) 🟢 | historical mean value: 724ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±10ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 40ms 1.03s 1.34s 1.07s 1.34s
domContentLoaded 733ms 37ms 715ms 1.01s 752ms 1.01s
firstPaint 79ms 10ms 60ms 160ms 84ms 160ms
firstContentfulPaint 79ms 10ms 60ms 160ms 84ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 13 Bytes (0%)
  • ui: 397 Bytes (0%)
  • common: 20 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [dbf1ec0]
UI Startup Metrics (1285 ± 114 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12851073151811413591473
load1071897131110311481258
domContentLoaded1064894129110111431247
domInteractive261697202282
firstPaint49910012803949991177
backgroundConnect22320027915231252
firstReactRender3219109133758
getState44161382849124
initialActions104113
loadScripts8506811077979141030
setupStore1363961426
numNetworkReqs1257620570
BrowserifyPower User HomeuiStartup20921768278219021522464
load1040907171613010291361
domContentLoaded1025898166813010201351
domInteractive35181362433104
firstPaint51412416994079821361
backgroundConnect25220775994235514
firstReactRender61391161765104
getState18813628131208249
initialActions109114
loadScripts81169014491288001142
setupStore20115072434
numNetworkReqs1497033260205244
WebpackStandard HomeuiStartup80069596867831953
load62456179260646777
domContentLoaded61955378760634772
domInteractive2515108212290
firstPaint21093780150198639
backgroundConnect952741116
firstReactRender2819133123137
getState251355103244
initialActions104112
loadScripts61655177858632762
setupStore1054251216
numNetworkReqs1257519569
WebpackPower User HomeuiStartup16161297230822117112071
load6865871246106698913
domContentLoaded6755801240106685906
domInteractive37182103035117
firstPaint319117950203367697
backgroundConnect62964215617593
firstReactRender604295106480
getState19015124420199228
initialActions105112
loadScripts6725781231105682898
setupStore191063112048
numNetworkReqs1637139564212303
FirefoxBrowserifyStandard HomeuiStartup13271039189515814311581
load1096891146211211731298
domContentLoaded1096891146111211731298
domInteractive60312553884111
firstPaint------
backgroundConnect49221833457124
firstReactRender23183852435
getState12792111123
initialActions103122
loadScripts1068878144310311391265
setupStore12591101132
numNetworkReqs1257017662
BrowserifyPower User HomeuiStartup26651927506359227264252
load1205997288430811991589
domContentLoaded1204996288330811981589
domInteractive1153567498111358
firstPaint------
backgroundConnect140251021159132485
firstReactRender59362803158104
getState287491214235347799
initialActions2139523
loadScripts1157965269625911681478
setupStore1446782190142681
numNetworkReqs94593265383240
WebpackStandard HomeuiStartup14811259188412715371809
load1229106415069112851421
domContentLoaded1229106415069112851420
domInteractive58271803381126
firstPaint------
backgroundConnect44201312544107
firstReactRender25198182837
getState126127131125
initialActions205123
loadScripts1202104814858412551367
setupStore15699161451
numNetworkReqs1256617764
WebpackPower User HomeuiStartup30422158639389629334834
load15311153311748915422889
domContentLoaded15311153311748915422889
domInteractive11631967122107379
firstPaint------
backgroundConnect164251168203151732
firstReactRender63392412961121
getState286681228251364841
initialActions2152523
loadScripts14601095297643514922656
setupStore13151002192113613
numNetworkReqs92593354784220
📊 Page Load Benchmark Results

Current Commit: dbf1ec0 | Date: 12/3/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±40ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 737ms (±36ms) 🟢 | historical mean value: 722ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±11ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 40ms 1.02s 1.34s 1.09s 1.34s
domContentLoaded 737ms 36ms 707ms 999ms 760ms 999ms
firstPaint 80ms 11ms 60ms 168ms 92ms 168ms
firstContentfulPaint 80ms 11ms 60ms 168ms 92ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 13 Bytes (0%)
  • ui: 397 Bytes (0%)
  • common: 20 Bytes (0%)

@jpuri jpuri added this pull request to the merge queue Dec 3, 2025
Merged via the queue into main with commit 292f3c1 Dec 3, 2025
336 of 338 checks passed
@jpuri jpuri deleted the dapp_swap_fixes branch December 3, 2025 08:55
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2025
@metamaskbot metamaskbot added the release-13.13.0 Issue or pull request that will be included in release 13.13.0 label Dec 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-13.13.0 Issue or pull request that will be included in release 13.13.0 size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants