Skip to content

feat: swaps batch sell slippage modal and remove tokens#30040

Open
infiniteflower wants to merge 10 commits into
mainfrom
swaps-4439-batchSell-quotes-2
Open

feat: swaps batch sell slippage modal and remove tokens#30040
infiniteflower wants to merge 10 commits into
mainfrom
swaps-4439-batchSell-quotes-2

Conversation

@infiniteflower
Copy link
Copy Markdown
Contributor

@infiniteflower infiniteflower commented May 12, 2026

Description

Adds per-token slippage configuration for Batch Sell by reusing the existing Unified Swaps slippage modal UI with explicit Swap and Batch Sell adapter routes.

The Batch Sell review token row now opens a token-scoped slippage modal from the existing customize action. Selected slippage values are stored in Redux by CaipAssetType, kept in sync with the selected token set when users remove tokens, and preserve the distinction between an unset token value and an explicit Auto selection. The existing Swap slippage modals now use explicit SwapDefaultSlippageModal and SwapCustomSlippageModal routes while Batch Sell uses separate BatchSellDefaultSlippageModal and BatchSellCustomSlippageModal routes.

This PR stores the Batch Sell slippage values for each token; quote request wiring will use these values when Batch Sell quote fetching is connected.

Changelog

CHANGELOG entry: Added per-token slippage settings and remove feature for Batch Sell tokens

Related issues

Refs: SWAPS-4439

Manual testing steps

Feature: Batch Sell per-token slippage controls

  Scenario: user opens slippage settings for a Batch Sell token
    Given MM_BATCH_SELL_ENABLED is true
    And user has selected multiple eligible Batch Sell source tokens
    And user is on the Batch Sell Review screen

    When user taps the customize action for one selected token
    Then the Batch Sell default slippage modal is displayed
    And the modal uses the selected token's slippage value

  Scenario: user selects a preset Batch Sell token slippage
    Given user is viewing the Batch Sell default slippage modal for a selected token

    When user selects a preset slippage option
    And user taps Submit
    Then the modal closes

    When user reopens slippage settings for the same token
    Then the previously selected slippage option is selected

  Scenario: user sets custom slippage for one Batch Sell token
    Given user is viewing the Batch Sell default slippage modal for a selected token

    When user taps Custom
    Then the Batch Sell custom slippage modal is displayed

    When user enters a valid custom slippage value
    And user taps Confirm
    Then the modal closes

    When user reopens slippage settings for the same token
    Then the custom slippage value is preserved for that token

  Scenario: user removes a Batch Sell token
    Given user has set slippage for a selected Batch Sell token
    And user is on the Batch Sell Review screen

    When user removes that token from the Batch Sell selection
    Then the removed token no longer appears on the review screen
    And its Batch Sell slippage entry is removed from the selected token state
Feature: Batch Sell token removal

  Scenario: user removes a token from Batch Sell Review
    Given the user has at least 3 sellable tokens on the same supported network
    And the user has selected 3 tokens from the Batch Sell token selection screen
    And the user is on the Batch Sell Review screen

    When the user taps the minus button on one token row
    Then that token row is removed from the Batch Sell Review screen
    And the remaining selected token rows are still displayed
    And the Review button remains disabled while quotes are loading

  Scenario: user cannot remove tokens below the Batch Sell minimum
    Given the user has selected 2 tokens from the Batch Sell token selection screen
    And the user is on the Batch Sell Review screen

    When the user views the token rows
    Then the minus button is disabled for each token row

    When the user taps a disabled minus button
    Then no token row is removed
    And both selected token rows remain displayed

Screenshots/Recordings

Before

N/A

After

Screen.Recording.2026-05-12.at.3.48.14.PM.mov
Screen.Recording.2026-05-13.at.3.43.52.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 new Batch Sell state and navigation flows (per-token slippage + token removal) that can affect swap/bridge UX if routing or Redux syncing is incorrect, but does not touch signing/auth or funds movement logic directly.

Overview
Adds per-token slippage configuration for Batch Sell by introducing BatchSellDefaultSlippageModal/BatchSellCustomSlippageModal routes that reuse the existing slippage UI and persist values in Redux as batchSellSlippages keyed by CaipAssetType (including preserving explicit Auto vs unset).

Updates Batch Sell Review to open the token-scoped slippage modal from the customize action, allow removing source tokens down to a 2-token minimum, and keep the slippage map synced with the currently selected tokens; both Batch Sell selection and review now resetBridgeState() on unmount.

Renames the existing swap slippage modal routes to explicit SWAP_* routes and updates callers/tests/types accordingly.

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

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 12, 2026
@metamaskbotv2 metamaskbotv2 Bot added the team-swaps-and-bridge Swaps and Bridge team label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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.

@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes branch from 7e9ad0c to d05d956 Compare May 12, 2026 13:47
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes-2 branch from 187da1e to 490850e Compare May 12, 2026 15:54
@github-actions github-actions Bot added size-XL and removed size-S labels May 12, 2026
@infiniteflower infiniteflower changed the title Swaps 4439 batch sell quotes 2 feat: swaps batch sell slippage modal May 12, 2026
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes branch from d05d956 to 219c754 Compare May 12, 2026 16:48
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes-2 branch 2 times, most recently from 57e28f5 to 8c0a345 Compare May 12, 2026 19:45
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes branch from 1364451 to 10cc80f Compare May 13, 2026 14:21
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes-2 branch from 8c0a345 to 61e5d8a Compare May 13, 2026 14:24
@infiniteflower infiniteflower changed the title feat: swaps batch sell slippage modal feat: swaps batch sell slippage modal and remove tokens May 13, 2026
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes-2 branch from e97f7d8 to 554f2ae Compare May 13, 2026 19:50
Base automatically changed from swaps-4439-batchSell-quotes to main May 15, 2026 16:44
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes-2 branch from 554f2ae to 13c94fd Compare May 15, 2026 17:46
@infiniteflower infiniteflower marked this pull request as ready for review May 15, 2026 17:48
@infiniteflower infiniteflower requested review from a team as code owners May 15, 2026 17:48
@infiniteflower infiniteflower removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 15, 2026
Comment thread app/components/UI/Bridge/Views/BatchSellReview/BatchSellReview.tsx
Comment thread app/components/UI/Bridge/Views/BatchSellReview/BatchSellReview.tsx Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d709db8. Configure here.

Comment thread app/core/NavigationService/types.ts
@infiniteflower infiniteflower force-pushed the swaps-4439-batchSell-quotes-2 branch from 6182d23 to b54c57f Compare May 15, 2026 20:36
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR introduces significant changes to the Bridge/Swap slippage modal system:

  1. Route Renaming (Breaking Change): DEFAULT_SLIPPAGE_MODALSWAP_DEFAULT_SLIPPAGE_MODAL and CUSTOM_SLIPPAGE_MODALSWAP_CUSTOM_SLIPPAGE_MODAL. Any E2E test that navigates to slippage modals via the old route names would break. The QuoteDetailsCard has been updated to use the new route name, but this is a critical navigation path in the swap flow.

  2. New Batch Sell Slippage Modals: New BatchSellDefaultSlippageModal and BatchSellCustomSlippageModal components added with their own Redux state management (batchSellSlippages).

  3. Redux State Changes: New batchSellSlippages field added to bridge state with new actions and selectors. The BatchSellTokenSelect now resets bridge state on unmount (instead of on mount), which could affect state management in the swap flow.

  4. Refactored Modal Architecture: DefaultSlippageModal and CustomSlippageModal are now pure content components (DefaultSlippageModalContent, CustomSlippageModalContent) without Redux/navigation dependencies, making them reusable.

SmokeSwap: Directly affected - the swap/bridge flow uses slippage modals, and the route names have changed. The QuoteDetailsCard (used in swap review screens) now navigates to SWAP_DEFAULT_SLIPPAGE_MODAL. All swap E2E tests should be run to verify the slippage modal navigation still works correctly.

SmokeConfirmations: Per tag description, when selecting SmokeSwap, also select SmokeConfirmations as swap flows involve transaction confirmations.

No other tags are warranted - the changes are isolated to the Bridge/Swap UI components and don't affect accounts, identity, network management, browser, snaps, or other areas.

Performance Test Selection:
The changes are focused on UI component refactoring (slippage modals) and Redux state additions for the Batch Sell feature. These are not performance-sensitive changes - they don't affect rendering performance of lists, app startup, login flows, or other performance-critical paths. The slippage modal is a secondary UI element that appears on user interaction, not in critical rendering paths measured by performance tests.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant