fix: show feedback in Quick Buy for unsupported Tron assets (TSA-659)#31456
fix: show feedback in Quick Buy for unsupported Tron assets (TSA-659)#31456xavier-brochard wants to merge 2 commits into
Conversation
Quick Buy on a TRC-20 asset (e.g. HTX on Tron) left the Buy button permanently disabled with no error shown. Tron passes the bridge controller's isNonEvmChainId check, so the sheet treated the chain as supported, but useAssetMetadata only validates Solana/EVM addresses, so the destination token never resolved, quotes were never requested, and no error state was ever set. - useQuickBuySetup: gate non-native assets on non-EVM chains other than Solana as unsupported, so the existing unsupported-chain message shows - useQuickBuySetup: add isDestTokenUnavailable for the defensive case where setup settles on a supported chain without resolving a dest token (e.g. Token Metadata API has no entry, native registry throws) - useQuickBuyController: pass isDestTokenUnavailable through to the sheet - QuickBuyAmountScreen: replace the buy flow with an explicit message for both terminal states instead of a silently disabled Buy button - locales: add social_leaderboard.quick_buy.token_unavailable - tests: cover Tron CAIP-19/bare-address gating, native TRX passthrough, settled-empty metadata, and the new message rendering Fixes #31420 Co-Authored-By: Claude Fable 5 <noreply@anthropic.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. |
…(TSA-659) The regular Swap UI supports Tron, so Quick Buy must too. Replaces the previous "non-native non-EVM = unsupported" gate with a real quote flow for TRC-20 destinations, mirroring how the Swap UI works: the asset page seeds its dest token directly from the token it already holds (toCurrentTokenAsBridgeToken) instead of re-fetching metadata. - QuickBuyTarget: optional tokenDecimals/tokenImage so hosts holding the fully-resolved token can pass its metadata along - AssetDetailsQuickBuy: forward decimals/image from the asset page token - useQuickBuySetup: build the dest BridgeToken directly from host-provided metadata (CAIP-19 trc20/token assetId for non-EVM via formatAddressToAssetId); revert the Tron unsupported gate - useAssetMetadata: accept Tron base58 addresses (isTronAddress) and emit trc20 CAIP-19 asset ids in toAssetId, so address-only targets (social feed) also resolve — Token API v3 serves tron:.../trc20:* assets - keep isDestTokenUnavailable + token_unavailable string as a genuine fallback when metadata truly cannot resolve Tests: Tron dest-token resolution (host metadata + API fallback), Tron pair quote request reaching BridgeController.fetchQuotes with the CAIP chain id and bare base58 token address, toAssetId/fetchAssetMetadata trc20 coverage, host metadata passthrough. Fixes #31420 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Per tag descriptions:
No E2E spec files directly test QuickBuy, but the functional changes to the QuickBuy controller, setup hook, and asset metadata are significant enough to warrant running the related smoke tests. Confidence is moderate (72) because there are no direct E2E tests for QuickBuy, so the impact is assessed indirectly through the feature areas these components belong to. Performance Test Selection: |
Description
Attempting a Quick Buy of a TRC-20 asset like HTX (Tron) left the Buy button permanently disabled with no error shown. Root cause: a gap between two support checks —
useQuickBuySetuptreats any chain passingisNonEvmChainIdas supported, and@metamask/bridge-controllerreturnstruefor Tron (tron:728126428), so the "unsupported chain" message never rendered.useAssetMetadata, which only accepts Solana base58 or EVM hex addresses. A Tron base58 address fails both, so the destination token staysundefinedforever — quotes are never requested, no error state is ever set, and the Buy button stays disabled via!destTokenwith zero feedback.This PR:
useQuickBuySetupnow marks non-native assets on non-EVM chains other than Solana (e.g. TRC-20 tokens) as unsupported, so the existing "This chain is not supported for Quick Buy yet" message renders. Native non-EVM assets (TRX, SOL, BTC) keep working via the native-asset registry.isDestTokenUnavailableflag covers the case where setup settles on a supported chain but no destination token resolves (metadata API empty/failed); the sheet shows a new localized message ("This token is not available for Quick Buy right now") instead of an inert buy flow.Also fixes TSA-658 (duplicate ticket).
Jira: TSA-659
Changelog
CHANGELOG entry: Fixed the Quick Buy sheet showing a permanently disabled Buy button with no feedback for unsupported assets such as TRC-20 tokens on Tron
Related issues
Fixes: #31420
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