fix: cp-7.81.0 always show native tokens and stablecoins in QuickBuy sell receive list (TSA-642)#31235
Conversation
…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>
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Key findings from investigation:
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: |
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 sameenrichTokenBalancepath (theisNativeAddressbranch 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
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
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.
useReceiveTokensbuilds one native per chain already covered by stablecoin candidates viagetNativeSourceToken, 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 onQuickBuyReceiveScreenwere 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.