Skip to content

Conversation

micaelae
Copy link
Member

@micaelae micaelae commented Sep 22, 2025

Description

The PR updates the default selected tokens when navigating to the Swap page

  • If the user navigates from the home page, the bip44DefaultPairs entry for eip155 are set as src and dest tokens
  • If the user navigates from a network's native asset details page (i.e BNB, AVAX), the src is set to the native asset, and dest is set to the network's mapped BRIDGE_CHAINID_COMMON_TOKEN_PAIR token
  • If the user navigates from any other asset detail page, the src is set to the asset and the dest is set to the BRIDGE_CHAINID_COMMON_TOKEN_PAIR for the network

Open in GitHub Codespaces

Changelog

CHANGELOG entry: feat: pre-fill Swap tokens with default BIP-44 pairs from remote config

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3032

Manual testing steps

  1. Navigate to Swap from home page
  2. Verify that ETH -> mUSD is pre-filled by default
  3. Navigate to Swap from linea:ETH asset page
  4. Verify that linea:ETH -> linea:mUSD is pre-filled by default
  5. Navigate to Swap from any ERC20 asset page
  6. Verify that the asset -> BRIDGE_CHAINID_COMMON_TOKEN_PAIR mapping for the network is pre-filled by default
  7. Verify that deep links still work using this generator: https://montoya.github.io/deeplinker/swap

Screenshots/Recordings

Before

After

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.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Sep 22, 2025
@metamaskbot
Copy link
Collaborator

metamaskbot commented Sep 22, 2025

✨ Files requiring CODEOWNER review ✨

🔄 @MetaMask/swaps-engineers (5 files, +177 -28)
  • 📁 ui/
    • 📁 ducks/
      • 📁 bridge/
        • 📄 selectors.test.ts +1 -1
        • 📄 selectors.ts +34 -4
        • 📄 utils.ts +4 -7
    • 📁 hooks/
      • 📁 bridge/
        • 📄 useBridging.test.ts +94 -3
        • 📄 useBridging.ts +44 -13

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: a1fe60a | Date: 9/23/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±74ms) 🟡 | historical mean value: 1.06s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 733ms (±84ms) 🟢 | historical mean value: 741ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 88ms (±125ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 74ms 1.00s 1.37s 1.29s 1.37s
domContentLoaded 733ms 84ms 697ms 1.27s 975ms 1.27s
firstPaint 88ms 125ms 56ms 1.33s 88ms 1.33s
firstContentfulPaint 88ms 125ms 56ms 1.33s 88ms 1.33s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [a1fe60a]
UI Startup Metrics (1216 ± 75 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1216109115537512521341
load104991513377310871181
domContentLoaded104189513297410791174
domInteractive18138191640
firstPaint691141124741410621159
backgroundConnect21620134314219233
firstReactRender24165162539
getState1356071624
initialActions4066758
loadScripts832685110672869967
setupStore952641022
WebpackHomeuiStartup1138907134911412261294
load954748117611310301098
domContentLoaded949744117211310261093
domInteractive16126191341
firstPaint1446333044167229
backgroundConnect16103561829
firstReactRender3832118153557
getState64183812
initialActions51194812
loadScripts946742117011310231090
setupStore86213818
FirefoxBrowserifyHomeuiStartup15061285188912615811739
load1298110215089413561468
domContentLoaded1297110215079413551467
domInteractive1103536858116236
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3618102163778
firstReactRender32255373449
getState827910717
initialActions4185848
loadScripts1269108614809013271437
setupStore12511814932
WebpackHomeuiStartup15771392189512916711855
load13451170160912114481581
domContentLoaded13451169160812014471581
domInteractive1043432556105285
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect31219393741
firstReactRender46396154956
getState63152610
initialActions3126334
loadScripts13221143158612214261562
setupStore96466919
Benchmark value 217 exceeds gate value 10 for chrome browserify home mean backgroundConnect
Benchmark value 25 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 4 exceeds gate value 1 for chrome browserify home mean initialActions
Benchmark value 833 exceeds gate value 830 for chrome browserify home mean loadScripts
Benchmark value 233 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 8 exceeds gate value 1.2 for chrome browserify home p95 initialActions
Benchmark value 967 exceeds gate value 940 for chrome browserify home p95 loadScripts
Benchmark value 22 exceeds gate value 17 for chrome browserify home p95 setupStore
Benchmark value 12 exceeds gate value 7 for chrome webpack home p95 initialActions
Benchmark value 1506 exceeds gate value 1405 for firefox browserify home mean uiStartup
Benchmark value 1298 exceeds gate value 1245 for firefox browserify home mean load
Benchmark value 1298 exceeds gate value 1239 for firefox browserify home mean domContentLoaded
Benchmark value 111 exceeds gate value 110 for firefox browserify home mean domInteractive
Benchmark value 37 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 32 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 5 exceeds gate value 1 for firefox browserify home mean initialActions
Benchmark value 1270 exceeds gate value 1230 for firefox browserify home mean loadScripts
Benchmark value 12 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 1739 exceeds gate value 1660 for firefox browserify home p95 uiStartup
Benchmark value 236 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 78 exceeds gate value 70 for firefox browserify home p95 backgroundConnect
Benchmark value 8 exceeds gate value 2 for firefox browserify home p95 initialActions
Benchmark value 32 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 104 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 32 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 46 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 3 exceeds gate value 1 for firefox webpack home mean initialActions
Benchmark value 285 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 56 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 4 exceeds gate value 2 for firefox webpack home p95 initialActions
Sum of mean exceeds: 515ms | Sum of p95 exceeds: 534.8ms
Sum of all benchmark exceeds: 1049.8ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 1.22 KiB (0.02%)
  • common: 250 Bytes (0%)

@micaelae micaelae marked this pull request as ready for review September 23, 2025 17:52
@micaelae micaelae requested a review from a team as a code owner September 23, 2025 17:52
@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 32db487 | Date: 9/23/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±77ms) 🟡 | historical mean value: 1.06s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 742ms (±89ms) 🟢 | historical mean value: 741ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±43ms) 🟢 | historical mean value: 80ms ⬆️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 77ms 1.01s 1.34s 1.30s 1.34s
domContentLoaded 742ms 89ms 700ms 1.29s 986ms 1.29s
firstPaint 81ms 43ms 60ms 500ms 88ms 500ms
firstContentfulPaint 81ms 43ms 60ms 500ms 88ms 500ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [32db487]
UI Startup Metrics (1192 ± 62 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1192105913426212331295
load102892011465810681140
domContentLoaded102191711405810621133
domInteractive17135361634
firstPaint67687114740510441104
backgroundConnect2111992386213223
firstReactRender24194352432
getState1353761623
initialActions50709519
loadScripts81669793657854924
setupStore96212915
WebpackHomeuiStartup1151926133310912401295
load968760112610110461083
domContentLoaded963756112110110421080
domInteractive16125091445
firstPaint1706347277183330
backgroundConnect16103661530
firstReactRender35334533541
getState64192611
initialActions62194814
loadScripts960754111910110401078
setupStore86192912
FirefoxBrowserifyHomeuiStartup15131328203413415721857
load1299115315458413551447
domContentLoaded1299115215448413551446
domInteractive1073433550116222
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3720219283688
firstReactRender32249293348
getState8217919613
initialActions712012739
loadScripts1271113314928313291418
setupStore12511015932
WebpackHomeuiStartup16361439216114017341911
load13861199168011814801633
domContentLoaded13851198167911814801632
domInteractive1064031545107210
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect34229493845
firstReactRender49386665259
getState73263713
initialActions41576410
loadScripts13611178165711914561605
setupStore1063551125
Benchmark value 212 exceeds gate value 10 for chrome browserify home mean backgroundConnect
Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions
Benchmark value 224 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 19 exceeds gate value 1.2 for chrome browserify home p95 initialActions
Benchmark value 14 exceeds gate value 7 for chrome webpack home p95 initialActions
Benchmark value 1513 exceeds gate value 1405 for firefox browserify home mean uiStartup
Benchmark value 1300 exceeds gate value 1245 for firefox browserify home mean load
Benchmark value 1300 exceeds gate value 1239 for firefox browserify home mean domContentLoaded
Benchmark value 38 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 32 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 7 exceeds gate value 1 for firefox browserify home mean initialActions
Benchmark value 1272 exceeds gate value 1230 for firefox browserify home mean loadScripts
Benchmark value 12 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 1857 exceeds gate value 1660 for firefox browserify home p95 uiStartup
Benchmark value 222 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 88 exceeds gate value 70 for firefox browserify home p95 backgroundConnect
Benchmark value 9 exceeds gate value 2 for firefox browserify home p95 initialActions
Benchmark value 32 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 1637 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1386 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1386 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 106 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 34 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 50 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 4 exceeds gate value 1 for firefox webpack home mean initialActions
Benchmark value 1361 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 210 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 59 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 10 exceeds gate value 2 for firefox webpack home p95 initialActions
Sum of mean exceeds: 566ms | Sum of p95 exceeds: 555.8ms
Sum of all benchmark exceeds: 1121.8ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 1.22 KiB (0.02%)
  • common: 250 Bytes (0%)

@micaelae micaelae enabled auto-merge September 24, 2025 15:37
@micaelae micaelae added this pull request to the merge queue Sep 24, 2025
Merged via the queue into main with commit fa04038 Sep 24, 2025
149 checks passed
@micaelae micaelae deleted the swaps3032-prefill-tokens branch September 24, 2025 17:28
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2025
@metamaskbot metamaskbot added the release-13.5.0 Issue or pull request that will be included in release 13.5.0 label Sep 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.5.0 Issue or pull request that will be included in release 13.5.0 size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants