Skip to content

fix: cp-7.81.0 always show native tokens and stablecoins in QuickBuy sell receive list (TSA-642)#31235

Merged
xavier-brochard merged 1 commit into
mainfrom
fix/tsa-642-quickbuy-sell-native-tokens
Jun 9, 2026
Merged

fix: cp-7.81.0 always show native tokens and stablecoins in QuickBuy sell receive list (TSA-642)#31235
xavier-brochard merged 1 commit into
mainfrom
fix/tsa-642-quickbuy-sell-native-tokens

Conversation

@xavier-brochard

@xavier-brochard xavier-brochard commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

In QuickBuy Sell mode the user sells the fixed position token and chooses which token to receive. The Receive picker (useReceiveTokens) only listed stablecoins (mUSD/USDC/USDT), so native tokens were never offered.

This PR extends the Receive candidate set to always include the native token of every chain already covered by the stablecoin candidates, so natives and stablecoins are always visible regardless of balance. Natives are built via the existing Bridge helper getNativeSourceToken(chainId) and enriched through the same enrichTokenBalance path (the isNativeAddress branch already handles native balance/pricing), so no controller changes were needed. Candidates are ordered stablecoin-before-native within each chain group and the position chain is sorted first, which keeps a stablecoin as the default selection (sellDestTokenOptions[0]).

Changelog

CHANGELOG entry: Fixed QuickBuy sell flow so native tokens are always shown alongside stablecoins in the "Receive" token list.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TSA-642

Manual testing steps

Feature: QuickBuy sell receive token list

  Scenario: user opens the Receive picker when selling a position
    Given I am on a trader position and open QuickBuy
    And I switch to Sell mode
    When I open the "Receive" token picker
    Then the list shows the native token and stablecoins for each supported chain
    And the position chain's stablecoin is selected by default
    And tokens I do not hold still appear with a $0.00 balance

Screenshots/Recordings

Before

N/A

After

N/A

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.

Made with Cursor


Note

Low Risk
UI-only expansion of receive picker options using existing bridge token helpers and enrichment; no auth or controller changes.

Overview
QuickBuy Sell mode’s Receive picker now lists native tokens (ETH, POL, etc.) in addition to stablecoins, fixing cases where natives were never offered.

useReceiveTokens builds one native per chain already covered by stablecoin candidates via getNativeSourceToken, merges them into the picker list, and keeps stablecoins before natives within each chain group so the default receive token (sellDestTokenOptions[0]) stays a stablecoin. Non-stable ERC-20s like WETH remain excluded. Comments on QuickBuyReceiveScreen were updated to describe stablecoin-or-native receive options; behavior is unchanged aside from the expanded list from the hook.

Tests cover natives in the list, zero-address natives, preferred-chain ordering, and stablecoin-first within the preferred chain.

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

…ve list (TSA-642)

The QuickBuy Sell-mode "Receive" picker only offered stablecoins. Add each
supported chain's native token to the candidate set so natives and stablecoins
are always visible, regardless of balance. A stablecoin remains the default
selection.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jun 8, 2026

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.

@mm-token-exchange-service mm-token-exchange-service Bot added team-social-ai Social & AI team INVALID-PR-TEMPLATE PR's body doesn't match template labels Jun 8, 2026
@github-actions github-actions Bot added the size-S label Jun 8, 2026
@mm-token-exchange-service mm-token-exchange-service Bot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 8, 2026
@xavier-brochard xavier-brochard marked this pull request as ready for review June 8, 2026 21:45
@xavier-brochard xavier-brochard changed the title fix: always show native tokens and stablecoins in QuickBuy sell receive list (TSA-642) fix: cp-7.81.0 always show native tokens and stablecoins in QuickBuy sell receive list (TSA-642) Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The three changed files are all within the isolated SocialLeaderboard/TraderPositionView/QuickBuy feature area:

  1. QuickBuyReceiveScreen.tsx: Only comment/JSDoc updates — no functional code changes.
  2. useReceiveTokens.ts: Adds native tokens (ETH, POL, etc.) as receive candidates alongside stablecoins in the QuickBuy Sell mode "Receive" picker. Uses the existing getNativeSourceToken utility from Bridge (not modifying it).
  3. useReceiveTokens.test.ts: Unit test additions to cover the new native token behavior.

Key findings from investigation:

  • No E2E test files (.e2e.ts, .e2e.js, .spec.ts) reference SocialLeaderboard, TraderPositionView, or QuickBuy — there are no existing E2E tests for this feature.
  • The SocialLeaderboard feature is gated by a remote feature flag (aiSocialLeaderboardEnabled), limiting blast radius.
  • No shared infrastructure, controllers, navigation components, or core modules are modified.
  • The getNativeSourceToken utility from Bridge is only consumed (not changed).
  • Changes are purely additive (adding native tokens to an existing token list) within a self-contained hook.
  • No performance-sensitive rendering paths, state management, or app startup code is affected.

Since there are no E2E tests covering this feature area and the changes are isolated, low-risk, and additive in nature, no E2E tags need to run.

Performance Test Selection:
The changes are confined to a token list hook within the QuickBuy feature. No UI rendering performance, list rendering at scale, state management, or app startup code is affected. The change simply adds native tokens to an existing array of candidates — no performance impact expected.

View GitHub Actions results

@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 8, 2026
@xavier-brochard xavier-brochard enabled auto-merge June 9, 2026 08:13
@xavier-brochard xavier-brochard added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit bedb452 Jun 9, 2026
110 checks passed
@xavier-brochard xavier-brochard deleted the fix/tsa-642-quickbuy-sell-native-tokens branch June 9, 2026 08:44
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 9, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.82.0 Issue or pull request that will be included in release 7.82.0 label Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.82.0 Issue or pull request that will be included in release 7.82.0 risk:low AI analysis: low risk size-S team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants