metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

feat: swaps new asset picker

Open bfullam opened this issue 3 months ago • 4 comments

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

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 BridgeTokenSelector with 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; adds isTradableToken usage 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; adjusts NETWORK_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.

bfullam avatar Nov 14 '25 14:11 bfullam

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.

github-actions[bot] avatar Nov 14 '25 14:11 github-actions[bot]

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.

Files with missing lines Patch % Lines
...onents/BridgeTokenSelector/BridgeTokenSelector.tsx 77.98% 18 Missing and 6 partials :warning:
...ge/components/BridgeTokenSelector/NetworkPills.tsx 66.66% 10 Missing and 3 partials :warning:
app/components/UI/Bridge/hooks/usePopularTokens.ts 85.96% 5 Missing and 3 partials :warning:
app/components/UI/Bridge/hooks/useSearchTokens.ts 91.52% 1 Missing and 4 partials :warning:
app/components/UI/Navbar/index.js 0.00% 4 Missing :warning:
.../BridgeTokenSelector/BridgeTokenSelector.styles.ts 33.33% 2 Missing :warning:
...ents/UI/Bridge/hooks/useTokensWithBalance/index.ts 75.00% 1 Missing and 1 partial :warning:
...pp/components/UI/Bridge/Views/BridgeView/index.tsx 50.00% 1 Missing :warning:
...ents/UI/Bridge/components/TokenInputArea/index.tsx 66.66% 1 Missing :warning:
...ents/UI/Bridge/hooks/useBalancesByAssetId/index.ts 90.90% 0 Missing and 1 partial :warning:
... and 1 more
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.

codecov-commenter avatar Nov 27 '25 18:11 codecov-commenter

🔍 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:

  1. New unified token selector with 'source' and 'dest' type parameter
  2. New hooks for popular tokens, search tokens, token selection, and balance management
  3. Navigation changes from modal-based to screen-based navigation
  4. 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

View GitHub Actions results

github-actions[bot] avatar Dec 16 '25 19:12 github-actions[bot]