Skip to content

feat: batch sell token select#29690

Merged
infiniteflower merged 24 commits into
mainfrom
swaps-4437-multiswap-token-select
May 13, 2026
Merged

feat: batch sell token select#29690
infiniteflower merged 24 commits into
mainfrom
swaps-4437-multiswap-token-select

Conversation

@infiniteflower
Copy link
Copy Markdown
Contributor

@infiniteflower infiniteflower commented May 4, 2026

Description

Adds the Batch Sell entry point and token selection flow for Unified Swaps. Users can select up to five same-network, non-zero-balance source tokens, excluding configured destination stablecoins, then hand them off to the quote flow.

This also adds the single-token high-rate alert path, Batch Sell Redux handoff state, network/value sorting, wallet-style token row price data, empty state handling, and focused unit coverage for the new flow.

This is hidden behind the env var MM_BATCH_SELL_ENABLED.

Changelog

CHANGELOG entry: Added Batch Sell token selection for selling up to five same-network tokens.

Related issues

Refs: SWAPS-4437

Manual testing steps

Feature: Batch Sell token selection

  Background:
    Given I am logged into MetaMask Mobile
    And Batch Sell is enabled

  Scenario: user opens Batch Sell from wallet actions
    Given I am on the wallet home screen

    When user opens the trade wallet actions menu
    And user taps "Batch Sell"
    Then the Batch Sell token selection screen should open
    And the subtitle should state that up to 5 tokens can be selected
    And the subtitle should state that all tokens must be on the same network

  Scenario: user selects multiple tokens for Batch Sell
    Given I am on the Batch Sell token selection screen
    And I have non-zero-balance tokens on a supported network

    When user selects between 2 and 5 tokens on the selected network
    Then the primary button should show "Continue with (N) tokens"

    When user taps the primary button
    Then the quote selector screen should open for the selected Batch Sell tokens

  Scenario: user changes networks and sorting
    Given I am on the Batch Sell token selection screen
    And multiple supported networks have sellable tokens

    When user selects a network pill
    Then the token list should show only non-zero-balance tokens from that network

    When user taps the Balance sort header
    Then the token list should reverse fiat balance sort direction

  Scenario: user has no sellable tokens
    Given I am on the Batch Sell token selection screen
    And I have no non-zero-balance tokens on any supported Batch Sell network

    Then the no sellable assets empty state should be shown
    And the "Explore tokens" button should be available

    When user taps "Explore tokens"
    Then the in-app Explore feed should open

  Scenario: user selects exactly one token
    Given I am on the Batch Sell token selection screen
    And exactly one token is selected

    When user taps "Continue with (1) token"
    Then the high rate alert modal should open

    When user taps "Yes, swap"
    Then the regular Unified Swap flow should open
    And the selected source token and configured destination stablecoin should be prefilled

Screenshots/Recordings

Before

N/A - not captured in this generated draft.

After

Screen.Recording.2026-05-06.at.6.12.55.PM.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Medium Risk
Adds a new Batch Sell entry point, navigation routes, and Redux handoff state, plus modifies shared token list UI (TokenSelectorItem) and token-balance filtering; regressions could affect token selection display/behavior and bridge/swaps navigation.

Overview
Introduces a new Batch Sell token selection screen in Bridge, allowing users to pick up to 5 same-network tokens (filtered to supported chains, non-zero balances, and excluding configured destination stablecoins), with network pills, balance sort toggling, and an empty state that links to Explore tokens.

Adds a single-token high-rate alert bottom sheet (HighRateAlertModal) that redirects users to the standard swaps flow, and wires multi-token selections to the quote flow via new bridge-slice state (batchSellSourceTokens) and selectors.

Extends TokenSelectorItem with optional secondaryRowContent, configurable balance text props, and flags to disable selected-row styling and network badges (used by the new Batch Sell rows showing fiat price + 24h % change), and gates the wallet entry point behind MM_BATCH_SELL_ENABLED / BATCH_SELL_ENABLED.

Reviewed by Cursor Bugbot for commit d095c9a. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-swaps-and-bridge Swaps and Bridge team label May 4, 2026
@infiniteflower infiniteflower changed the title Swaps 4437 multiswap token select feat: multi swap token select May 4, 2026
@infiniteflower infiniteflower changed the title feat: multi swap token select feat: batch sell token select May 6, 2026
@infiniteflower infiniteflower force-pushed the swaps-4437-multiswap-token-select branch from 44b8a5b to 5d2232f Compare May 6, 2026 21:28
@github-actions github-actions Bot added size-XL and removed size-M labels May 6, 2026
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 6, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​assets-controller@​6.3.0 ⏵ 6.4.069 +110080 +198 +1100
Updatednpm/​@​metamask/​bridge-controller@​71.0.0 ⏵ 71.1.196 +110079 +198 +1100

View full report

@infiniteflower infiniteflower marked this pull request as ready for review May 6, 2026 22:44
@infiniteflower infiniteflower requested review from a team as code owners May 6, 2026 22:44
@infiniteflower infiniteflower enabled auto-merge May 6, 2026 22:44
Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx
@infiniteflower infiniteflower force-pushed the swaps-4437-multiswap-token-select branch from 25d540c to 0d52e36 Compare May 7, 2026 14:47
Comment thread app/components/Views/TradeWalletActions/TradeWalletActions.test.tsx
Comment thread app/components/UI/Bridge/hooks/useTokensWithBalance/index.ts
Comment thread app/components/UI/Bridge/constants/tokens.ts
Copy link
Copy Markdown
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI LGTM!

@infiniteflower infiniteflower force-pushed the swaps-4437-multiswap-token-select branch from d5df801 to e2f836c Compare May 8, 2026 14:46
GeorgeGkas
GeorgeGkas previously approved these changes May 8, 2026
@infiniteflower infiniteflower force-pushed the swaps-4437-multiswap-token-select branch from e5ba722 to b5fb119 Compare May 12, 2026 16:48
Comment thread app/constants/bridge.ts
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/bridge-controller. Running all tests.

Performance Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/bridge-controller. Running all tests.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@infiniteflower infiniteflower added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit f2533f3 May 13, 2026
794 of 834 checks passed
@infiniteflower infiniteflower deleted the swaps-4437-multiswap-token-select branch May 13, 2026 07:49
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants