-
Notifications
You must be signed in to change notification settings - Fork 5.4k
refactor: remove unused swap selectors and fix selector types #38413
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
base: main
Are you sure you want to change the base?
Conversation
✨ Files requiring CODEOWNER review ✨🕵️ @MetaMask/extension-privacy-reviewers (1 files, +0 -2)
🧪 @MetaMask/qa (1 files, +0 -2)
🔄 @MetaMask/swaps-engineers (26 files, +354 -1605)
|
Builds ready [31288a4]
UI Startup Metrics (1248 ± 120 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [bd81e44]
UI Startup Metrics (1452 ± 153 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [a51b7d8]
UI Startup Metrics (1227 ± 113 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [ae45132]
UI Startup Metrics (1277 ± 115 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [de91a29]
UI Startup Metrics (1313 ± 126 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [b4a84dc]
UI Startup Metrics (1247 ± 101 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [d884a21]
UI Startup Metrics (1250 ± 123 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [e4d03e8]
UI Startup Metrics (1283 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [ecbf219]
UI Startup Metrics (1260 ± 112 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [ecbf219]
UI Startup Metrics (1260 ± 112 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [1450d09]
UI Startup Metrics (1277 ± 120 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| */ | ||
| export type BridgeNetwork = { | ||
| name: string; | ||
| nativeCurrency: string; |
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.
is the value of nativeCurrency the ticker of the gas token of the network?
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.
Yea, it's the gas token ticker
ui/hooks/useMultichainBalances.ts
Outdated
| symbol: assetMetadataById[caipAssetId]?.symbol ?? '', | ||
| assetId: caipAssetId, | ||
| address: assetReference, | ||
| isNative: assetNamespace === 'slip44', |
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.
Is it worth saving slip44 in a variable in case we need to use it in other places as well?
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.
Good call - added one
Builds ready [92155e9]
UI Startup Metrics (1390 ± 138 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This cleans up
bridgeredux state, selectors and actions to prepare for the AssetPicker refactortoTokenExchangeRateandtoTokenUsdExchangeRatefrom stateuseBridgeExchangeRatesto only fetch source exchange ratesgetAllBridgeableNetworks,getToTokenConversionRate,getIsBridgeTxNetworkConfigurationtype references withBridgeNetwork(minimal network object required by swaps) for better type safetyChangelog
CHANGELOG entry: refactor: remove unused swap selectors and fix types
Related issues
Fixes: N/A
Manual testing steps
No user-facing changes
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Cleans up bridge state and selectors by dropping destination exchange-rate handling, tightening types (incl. BridgeNetwork), simplifying actions/hooks, and updating tests/stories accordingly.
toTokenExchangeRateandtoTokenUsdExchangeRatefrombridgestate and related actions/thunks.setFromChainto acceptchainId(Hex/CAIP) and derive network client id; auto-select native token for non‑EVM.setSrcTokenExchangeRates.getAllBridgeableNetworkswith record-based lookup frommultichainNetworkConfigurationsByChainId.getToTokenConversionRate,getIsBridgeTx).BridgeNetworktype; refine balances and validation logic; expose price impact thresholds and no-fee assets via feature flags.useBridgeExchangeRatesnow fetches only source token rates and uses cache.useBridgeQueryParamsupdated to work with new types and chain selection flow.useSolanaBridgeTransactionMappinghook.isQuoteExpiredOrInvalid,isNetworkAdded, and image/balance handling; addsafeAmountForCalc.featureFlagOverrides: { bridgeConfig }andBridgeControllerStatefields; adjust snapshots and fixtures to new shapes.ALLOWED_BRIDGE_CHAIN_IDSasconst; addSLIP44_ASSET_NAMESPACE.Written by Cursor Bugbot for commit 92155e9. This will update automatically on new commits. Configure here.