Skip to content

fix: show feedback in Quick Buy for unsupported Tron assets (TSA-659)#31456

Draft
xavier-brochard wants to merge 2 commits into
mainfrom
fix/tsa-659-quickbuy-tron-no-feedback
Draft

fix: show feedback in Quick Buy for unsupported Tron assets (TSA-659)#31456
xavier-brochard wants to merge 2 commits into
mainfrom
fix/tsa-659-quickbuy-tron-no-feedback

Conversation

@xavier-brochard

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

Copy link
Copy Markdown
Contributor

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 —

  1. useQuickBuySetup treats any chain passing isNonEvmChainId as supported, and @metamask/bridge-controller returns true for Tron (tron:728126428), so the "unsupported chain" message never rendered.
  2. But non-native destination tokens must resolve via useAssetMetadata, which only accepts Solana base58 or EVM hex addresses. A Tron base58 address fails both, so the destination token stays undefined forever — quotes are never requested, no error state is ever set, and the Buy button stays disabled via !destToken with zero feedback.

This PR:

  • Primary gate: useQuickBuySetup now 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.
  • Defensive surfacing: a new isDestTokenUnavailable flag 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

Feature: Quick Buy feedback for unsupported assets

  Scenario: user opens Quick Buy for a TRC-20 token
    Given the user navigates to the token details page of HTX on Tron

    When the user opens the Quick Buy sheet
    Then a "This chain is not supported for Quick Buy yet" message is shown
    And the Buy button is disabled

  Scenario: destination token fails to resolve on a supported chain
    Given the user opens Quick Buy for a token whose metadata cannot be fetched

    When the setup settles without a destination token
    Then a "This token is not available for Quick Buy right now" message is shown

  Scenario: supported assets still work
    Given the user opens Quick Buy for USDC on Base
    Then the buy flow behaves as before (quotes load, button enables)

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.

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>
@xavier-brochard xavier-brochard self-assigned this Jun 10, 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.

…(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>
@github-actions github-actions Bot added size-L and removed size-M labels Jun 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The PR makes changes to:

  1. QuickBuy flow (SocialLeaderboard/TraderPositionView): Adds isDestTokenUnavailable state, tokenDecimals/tokenImage to QuickBuyTarget type, and a new error message for when token metadata can't be resolved. This is the QuickBuy sheet used in Perps and Predictions trading flows. → SmokePerps, SmokePredictions

  2. Bridge/useAssetMetadata: Adds Tron address detection (isTronAddress) to the asset metadata hook, and Tron chain support (isTronChainId) to the toAssetId utility. This affects how bridge/swap resolves token metadata. → SmokeSwap

  3. AssetDetailsQuickBuy: Passes pre-resolved token metadata (decimals, image) from the asset details page to QuickBuy, avoiding a metadata re-fetch. This is used in TokenDetails and MarketInsightsView. → SmokeWalletPlatform (Trending/token details)

  4. Localization: New string token_unavailable for QuickBuy sheet.

Per tag descriptions:

  • SmokePerps: QuickBuy is the Add Funds flow entry point for Perps; changes to QuickBuy logic directly affect this. Also requires SmokeWalletPlatform (Trending section) and SmokeConfirmations (on-chain transactions).
  • SmokePredictions: QuickBuy is used in Predictions flows; also requires SmokeWalletPlatform and SmokeConfirmations.
  • SmokeSwap: Bridge asset metadata changes affect swap quote fetching and token resolution.
  • SmokeConfirmations: Required when selecting SmokePerps, SmokePredictions, and SmokeSwap per their tag descriptions.
  • SmokeWalletPlatform: Required when selecting SmokePerps and SmokePredictions (Trending section).

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:
The changes are focused on QuickBuy logic (token metadata resolution, error state handling) and Bridge asset metadata (Tron address support). These are functional correctness fixes rather than performance-sensitive changes. No performance test scenarios (account list rendering, onboarding, login, swaps timing, app launch, asset loading, predict markets, perps trading) are directly impacted by these changes. The QuickBuy flow changes add a new state flag and bypass a metadata fetch when data is already available (which could marginally improve performance), but this is not significant enough to warrant performance test runs.

View GitHub Actions results

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

Labels

size-L team-social-ai Social & AI team

Projects

Status: Needs dev review

Development

Successfully merging this pull request may close these issues.

[Bug]: Quick Buy on HTX (Tron) - Buy button never gets enabled with no error message shown

1 participant