feat: swaps new asset picker
Description
Changelog
CHANGELOG entry: Added new swaps asset picker
Related issues
Fixes:
Manual testing steps
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [ ] I’ve followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards.
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
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] Replaces Bridge source/dest token and network selectors with a single network-filtered token selector (search, popular tokens, balances), updates routes/navigation, and adds supporting hooks/tests.
- Bridge UX:
- Unified Token Selector: Adds
BridgeTokenSelectorwith network pills, search (debounced), popular tokens, pagination, and balance merge; updates navbar and strings.- Navigation: Replaces modal routes with
Routes.BRIDGE.TOKEN_SELECTOR; updates all call sites (e.g.,BridgeView,TokenInputArea).- Removals: Deletes
BridgeSource/DestTokenSelector,BridgeSource/DestNetworkSelector, and networks bars; removes related snapshots.- Logic/Hooks:
- New hooks:
usePopularTokens,useSearchTokens,useTokensWithBalances,useBalancesByAssetId,useTokenSelection; addsisTradableTokenusage and CAIP/EVM normalization.TokenSelectorItem: layout tweaks, consistent "No MM Fee" badge handling.- Fee disclaimer copy simplified when no MM fee.
- Routing/Constants:
- Adds
Routes.BRIDGE.TOKEN_SELECTOR; adjustsNETWORK_TO_SHORT_NETWORK_NAME_MAP(e.g., BTC label); e2e selectors/mocks updated.- Tests/E2E:
- Extensive unit tests for new hooks/components; updates e2e mocks to support popular tokens and network ranking; fixes scrolling for token tap.
Written by Cursor Bugbot for commit 357ac7d2e0868fed2a23f2ccb052589be0540cef. This will update automatically on new commits. Configure here.
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.
Codecov Report
:x: Patch coverage is 83.15217% with 62 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 78.74%. Comparing base (435690e) to head (800fc6c).
:warning: Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #22712 +/- ##
==========================================
+ Coverage 78.71% 78.74% +0.02%
==========================================
Files 4020 4029 +9
Lines 104625 105007 +382
Branches 20999 21091 +92
==========================================
+ Hits 82352 82684 +332
- Misses 16536 16573 +37
- Partials 5737 5750 +13
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
🔍 Smart E2E Test Selection
- Selected E2E tags: SmokeTrade, SmokeSwaps
- Risk Level: medium
- AI Confidence: 90%
click to see 🤖 AI reasoning details
This PR is a significant refactoring of the Bridge token selector functionality that consolidates multiple separate components (BridgeSourceTokenSelector, BridgeDestTokenSelector, BridgeSourceNetworkSelector, BridgeDestNetworkSelector) into a single unified BridgeTokenSelector component.
Key changes include:
- New unified token selector with 'source' and 'dest' type parameter
- New hooks for popular tokens, search tokens, token selection, and balance management
- Navigation changes from modal-based to screen-based navigation
- E2E test infrastructure updates including new mocks for popular tokens API and feature flags
The E2E tests in e2e/specs/swaps/ are tagged with SmokeTrade (bridge-action-smoke.spec.ts, swap-action-smoke.spec.ts, gasless-swap.spec.ts) and SmokeSwaps (unified-ui-wallet-actions.spec.ts). These tests directly exercise the Bridge and Swap functionality that this PR modifies.
The test mocks have been updated (bridge-mocks.ts, swap-mocks.ts) to support the new popular tokens API endpoint and feature flags, indicating the E2E tests are designed to work with these changes.
Risk is medium because:
- The changes are substantial but well-contained to the Bridge/Swap feature area
- E2E test infrastructure has been updated to support the changes
- No core/critical infrastructure (Engine, Controllers) is modified
- The changes are primarily UI/UX refactoring with new API integrations
Quality Gate passed
Issues
3 New issues
0 Accepted issues
Measures
1 Security Hotspot
84.2% Coverage on New Code
0.0% Duplication on New Code