Skip to content

feat: add Quick Trade button to each crypto token row#31805

Merged
salimtb merged 14 commits into
mainfrom
feat/explore-search-quick-trade-button
Jun 22, 2026
Merged

feat: add Quick Trade button to each crypto token row#31805
salimtb merged 14 commits into
mainfrom
feat/explore-search-quick-trade-button

Conversation

@salimtb

@salimtb salimtb commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Each token row in the Explore search results (both "All" and "Crypto" tabs) now shows a circular flash-icon button that opens the existing QuickBuy sheet pre-loaded for that token.

Key changes:

  • Add optional onQuickTrade prop to TrendingTokenRowItem, rendered as a 36 px dark circle with a flash icon (DS Icon, theme-aware bg)
  • Thread onQuickTrade through TokenSearchRowItem -> SearchFeedRow (tokens feed only, stocks/perps/etc. are unaffected)
  • ExploreSearchResults: replace empty BottomSheet with TrendingQuickBuy adapter; FullFeedList in ExploreSearchScreen wired up identically
  • New TrendingQuickBuy UI-layer adapter maps TrendingAsset to QuickBuyTarget and renders QuickBuy.Root, keeping TrendingView isolated from SocialLeaderboard
  • Analytics: add 'explore_search' to SocialLeaderboardSource and QuickBuySheetSource; fire SOCIAL_QUICK_BUY_SHEET_VIEWED on open with source, caip19, and marketCap; forward analyticsContext to QuickBuy.Root so all downstream events are attributed correctly
  • Tests: TrendingTokenRowItem button render/press/navigation guards; TrendingQuickBuy target mapping and event firing lifecycle; SearchFeedRow onQuickTrade forwarding and isolation
  • Locale: add trending.quick_trade = "Quick Buy & Sell"

Description

Changelog

CHANGELOG entry: add Quick Trade button to each crypto token row on explore search

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Screen.Recording.2026-06-17.at.10.41.08.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
Reuses the existing Quick Buy trade path from many Explore entry points; mistakes in asset mapping or analytics gating could mis-attribute trades or affect experiment readouts, though UI is flag-gated.

Overview
Adds an Explore Quick Buy A/B test (assetsASSETS3380AbtestExploreQuickBuy) so the treatment arm can show a flash Quick Trade control on eligible token and stock rows across Explore (search, Crypto/RWAs tabs, trending/stocks full lists).

TrendingQuickBuy is a new adapter that maps TrendingAssetQuickBuy.Root, fires SOCIAL_QUICK_BUY_SHEET_VIEWED when a sheet opens, and passes per-surface source values (explore_search, explore_crypto, explore_trending, etc.). onQuickTrade is threaded through list layouts and TrendingTokenRowItem (press isolated from row navigation).

Analytics wiring adds Explore-specific quick-buy sources, registers the new experiment mapping, extends A/B enrichment with array-based inject gates and excludeWhenPropertiesMatch so Social AI Quick Buy attribution does not apply on Explore surfaces. Tests cover row behavior, adapter mapping/events, search row forwarding, and AB config structure.

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

Each token row in the Explore search results (both "All" and "Crypto"
tabs) now shows a circular flash-icon button that opens the existing
QuickBuy sheet pre-loaded for that token.

Key changes:
- Add optional onQuickTrade prop to TrendingTokenRowItem, rendered as
  a 36 px dark circle with a flash icon (DS Icon, theme-aware bg)
- Thread onQuickTrade through TokenSearchRowItem -> SearchFeedRow
  (tokens feed only, stocks/perps/etc. are unaffected)
- ExploreSearchResults: replace empty BottomSheet with TrendingQuickBuy
  adapter; FullFeedList in ExploreSearchScreen wired up identically
- New TrendingQuickBuy UI-layer adapter maps TrendingAsset to QuickBuyTarget
  and renders QuickBuy.Root, keeping TrendingView isolated from
  SocialLeaderboard per ADR-0020
- Analytics: add 'explore_search' to SocialLeaderboardSource and
  QuickBuySheetSource; fire SOCIAL_QUICK_BUY_SHEET_VIEWED on open with
  source, caip19, and marketCap; forward analyticsContext to QuickBuy.Root
  so all downstream events are attributed correctly
- Tests: TrendingTokenRowItem button render/press/navigation guards;
  TrendingQuickBuy target mapping and event firing lifecycle;
  SearchFeedRow onQuickTrade forwarding and isolation
- Locale: add trending.quick_trade = "Quick Buy & Sell"
@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.

@metamask-ci

metamask-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Description section is empty. Describe what changed and why.
  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.
  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Pre-merge author checklist has unchecked items (e.g. "I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

salimtb added 2 commits June 16, 2026 14:26
…3380

Flag: assetsASSETS3380AbtestExploreQuickBuy (LaunchDarkly JSON)
- control   (0–50%): button hidden — status quo
- treatment (50–100%): flash button visible on each crypto token row

Changes:
- New abTestConfig.ts: flag key, variant enum, variant config, and
  analytics mapping for ASSETS-3380
- ExploreSearchResults + FullFeedList (ExploreSearchScreen): onQuickTrade
  is only wired when variant.showQuickTradeButton is true; useABTest
  auto-fires Experiment Viewed once per session
- abTestAnalyticsRegistry: register EXPLORE_QUICK_BUY mapping so that
  SOCIAL_QUICK_BUY_SHEET_VIEWED, AMOUNT_SELECTED, TRADE_SUBMITTED,
  TRADE_COMPLETED, and DISMISSED are auto-enriched with active_ab_tests
- abTestConfig.test.ts: 11 tests covering flag key, control/treatment
  behaviour, exposure metadata, and all enriched event names
@salimtb salimtb marked this pull request as ready for review June 17, 2026 08:43
@salimtb salimtb requested a review from a team as a code owner June 17, 2026 08:43
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 17, 2026
@salimtb salimtb requested a review from a team as a code owner June 17, 2026 08:46
@salimtb salimtb changed the title feat(explore-search): add Quick Trade button to each crypto token row feat: add Quick Trade button to each crypto token row Jun 17, 2026
@salimtb salimtb removed the request for review from a team June 17, 2026 09:10
@github-actions github-actions Bot added risk:low AI analysis: low risk and removed risk:medium AI analysis: medium risk labels Jun 17, 2026

@xavier-brochard xavier-brochard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ QuickBuyRoot change causes a regression

The fix: fix bottom sheet close commit (585d816) re-adds a BottomSheetOverlay to the shared QuickBuyRoot. That reintroduces behaviour we intentionally removed from the QuickBuy sheet.

Intended behaviour of the QuickBuy sheet (by design):

  • No backdrop / no dimmed scrim behind the sheet.
  • The surface below stays interactive — tapping outside the sheet should do nothing, because the user must be able to keep interacting with the content underneath.

BottomSheetOverlay does exactly the opposite of both:

  • It renders a full-screen absolute inset-0 bg-overlay-default view animated to full opacity → dims the background.
  • When onPress is set (the normal !isSubmittingTx path) it renders a flex-1 TouchableOpacity covering the whole screen → captures all touches over the surface below and closes the sheet, so the underlying surface is no longer interactive.

Because this lives in the shared QuickBuyRoot, it forces this modal behaviour on every host of QuickBuy.Root, not just Explore search:

  • TraderPositionQuickBuy (Top Traders)
  • AssetDetailsQuickBuy (Token Details / Market Insights)
  • TrendingQuickBuy (this PR)

Suggestion: revert the overlay change. If a specific surface genuinely needs dismiss-on-outside-press, make it an opt-in prop (e.g. withOverlay / dismissOnOutsidePress, default false) wired only for that surface, rather than changing the default behaviour of the shared root. Swipe-to-dismiss / drag handle (already supported via isInteractable) or an explicit close button can cover the "can't close it" case without a blocking scrim.

@salimtb salimtb marked this pull request as draft June 17, 2026 16:08
salimtb added 3 commits June 21, 2026 23:10
- Wire Quick Buy to CryptoTab (explore_crypto), RwasTab (explore_rwas),
  TrendingTokensFullView (explore_trending), and RWATokensFullView
  (explore_stocks) with correct per-surface analytics source values
- Fix TokenRowItem to forward onQuickTrade prop to TrendingTokenRowItem
- Make TrendingQuickBuy accept a configurable source prop (defaults to
  explore_search) and thread it through TokenListPageLayout,
  TrendingTokensData, and TrendingTokensList
- Add explore_crypto/now/rwas/trending/stocks to SocialLeaderboardSource
  and QuickBuySheetSource types
- Extend ABTestAnalyticsMapping with excludeWhenPropertiesMatch (array
  support) and add array support to injectWhenPropertiesMatch
- Scope socialAiTSA612AbtestQuickBuy to exclude all explore_* sources
- Scope assetsASSETS3380AbtestExploreQuickBuy to inject for all explore_*
  sources only
Reverts the dismiss-on-outside-press regression introduced in 585d816.

The QuickBuy sheet is intentionally overlay-free: no scrim, no background
dimming, and the surface below stays interactive. BottomSheetOverlay was
blocking all touches on the underlying content and closing the sheet when
tapping outside, which is the opposite of the intended behaviour.

Also removes the now-unnecessary BottomSheetOverlay stub from
QuickBuySheet.test.tsx.
Resolve conflicts:
- TrendingTokenRowItem.test.tsx: keep Quick Trade tests + add new
  memoization test from main
- ExploreSearchResults.tsx: adopt main's MMDSSectionHeader/SectionDivider
  section header design
- CryptoTab.tsx / RwasTab.tsx: adopt main's ExploreSectionList refactor
  while preserving Quick Buy View wrapper and TrendingQuickBuy sheet
@salimtb salimtb marked this pull request as ready for review June 21, 2026 22:36
Comment thread app/components/Views/TrendingView/tabs/CryptoTab.tsx Outdated
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:low AI analysis: low risk labels Jun 21, 2026
zone-live
zone-live previously approved these changes Jun 22, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 db2640e. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
This PR introduces a "Quick Trade" (Quick Buy) button A/B test feature across the Trending/Explore section of the wallet. The changes span multiple Trending views (CryptoTab, RwasTab, ExploreSearchResults, RWATokensFullView, TrendingTokensFullView) and shared components (TrendingTokenRowItem, TrendingTokensList, TokenListPageLayout, SearchFeedRow, TokenRowItem).

SmokeWalletPlatform: The Trending tab is the primary surface affected. The tag description explicitly states "Trending is the connecting point for all subsections—changes to Perps, Predictions, or Tokens views (headers, lists, full views) that are embedded in Trending affect this tag." The existing E2E tests in tests/smoke/trending/ (trending-feed.spec.ts, trending-search.spec.ts, trending-browser.spec.ts) all use SmokeWalletPlatform and test the exact views modified in this PR.

SmokeSwap: The Quick Trade button opens a QuickBuy sheet that initiates swap/trade flows. The TrendingQuickBuy component wraps the existing QuickBuy component from SocialLeaderboard. Per the SmokeSwap tag description, swap flows should be validated.

SmokeConfirmations: The Quick Buy flow involves on-chain transactions that require confirmation screens. Per the SmokeSwap tag description, "when selecting SmokeSwap, also select SmokeConfirmations."

SmokePerps: The RwasTab (which is modified) contains a Perps section. Per the SmokePerps tag description, "Perps is also a section inside the Trending tab (SmokeWalletPlatform); changes to Perps views affect Trending." The RwasTab changes include the Quick Trade button integration which could affect the Perps section rendering. Per SmokePerps description, "when selecting SmokePerps, also select SmokeWalletPlatform."

The analytics infrastructure change (enrichWithABTests.ts adding excludeWhenPropertiesMatch logic) is a shared utility but only affects A/B test enrichment behavior, not core transaction or account flows. The localization change (en.json) adds a single "quick_trade" string.

Risk is medium because: the changes are feature additions (not modifications to core flows), they're gated behind an A/B test flag, and the Quick Buy component being reused from SocialLeaderboard is already tested. However, the integration across multiple Trending views and the analytics infrastructure change warrant validation.

Performance Test Selection:
The changes add a Quick Trade button to token rows in the Trending/Explore section via an A/B test. While this adds new UI elements to token rows, the button is conditionally rendered only when the A/B test treatment variant is active (showQuickTradeButton: true). The core token list rendering performance is not fundamentally changed - the onQuickTrade prop is simply passed through the component tree. The A/B test infrastructure changes (enrichWithABTests.ts) are analytics-only and don't affect rendering performance. No performance test files were modified. The changes don't impact app launch, login, onboarding, asset loading, or swap execution performance in a measurable way that would warrant performance test runs.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@salimtb salimtb added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit 0817ea2 Jun 22, 2026
123 of 124 checks passed
@salimtb salimtb deleted the feat/explore-search-quick-trade-button branch June 22, 2026 12:01
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-8.1.0 Issue or pull request that will be included in release 8.1.0 label Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.1.0 Issue or pull request that will be included in release 8.1.0 risk:medium AI analysis: medium risk size-XL team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants