Skip to content

feat: add Quick Buy button to Market Insights and related analytics#31014

Merged
xavier-brochard merged 2 commits into
mainfrom
tsa-599-quick-buy-entrypoint-market-insights
Jun 4, 2026
Merged

feat: add Quick Buy button to Market Insights and related analytics#31014
xavier-brochard merged 2 commits into
mainfrom
tsa-599-quick-buy-entrypoint-market-insights

Conversation

@xavier-brochard

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

Copy link
Copy Markdown
Contributor

Description

Screen.Recording.2026-06-03.at.14.57.07.mov

This PR adds the QuickBuy "flash" button entry point to the Market Insights view, mirroring its existing implementation in the parent Asset Details (Token Details) view.

  1. Reason for the change: Market Insights already renders the shared TokenDetailsStickyFooter, but it did not expose the QuickBuy lightning button that Asset Details offers. Users reading an asset's Market Insights had no fast path to buy.
  2. Improvement/solution: Wire the footer's existing onQuickBuyPress/quickBuyTestID slot in MarketInsightsView, gated behind the same socialAiAssetDetailsQuickBuy feature flag, and open the reused AssetDetailsQuickBuy sheet with the in-scope stickyFooterToken. The sheet reports a distinct market_insights analytics source (a new value added to SocialLeaderboardSource/QuickBuySheetSource), and pressing the button fires a MARKET_INSIGHTS_INTERACTION event with interaction_type: 'quick_buy', parallel to the existing swap/buy handlers.

Note: the new analytics values (market_insights source, quick_buy interaction type) are registered in a companion segment-schema PR so the events pass schema validation.

Changelog

CHANGELOG entry: Added a Quick Buy button to the Market Insights view for faster asset purchases.

Related issues

Fixes: TSA-599

Manual testing steps

Feature: Quick Buy from Market Insights

  Scenario: User opens Quick Buy from the Market Insights view
    Given the socialAiAssetDetailsQuickBuy feature flag is enabled
    And the user is on a token's Market Insights view (non-perps)
    When the user taps the Quick Buy (lightning) button in the sticky footer
    Then the QuickBuy bottom sheet opens for that token
    And a Market Insights interaction event is tracked with interaction_type "quick_buy"
    And the QuickBuy sheet reports analytics source "market_insights"

  Scenario: Flag disabled hides the button
    Given the socialAiAssetDetailsQuickBuy feature flag is disabled
    When the user is on a token's Market Insights view
    Then the Quick Buy button is not rendered
    And the QuickBuy sheet is not mounted

Screenshots/Recordings

Before

After

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

Medium Risk
Exposes an in-app purchase/swap path from a new screen behind a flag, but reuses existing QuickBuy and footer gating rather than new payment logic.

Overview
Adds a Quick Buy (lightning) entry point on Market Insights for non-perps token views, using the same socialAiAssetDetailsQuickBuy flag and shared TokenDetailsStickyFooter / AssetDetailsQuickBuy flow as Asset Details.

When the flag is on, the sticky footer receives onQuickBuyPress and a new test ID; tapping it triggers haptics, opens the QuickBuy sheet for stickyFooterToken, and emits MARKET_INSIGHTS_INTERACTION with interaction_type: 'quick_buy'. QuickBuy analytics now accept an optional source (default asset_details; Market Insights passes market_insights), with QuickBuySheetSource / SocialLeaderboardSource extended accordingly.

TokenDetailsStickyFooter only shows Quick Buy when there is an eligible swap source (hasEligibleSwapTokens). The Market Insights footer disclaimer moves into the scroll content above “What’s being said” instead of sitting under the sticky footer.

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

This commit introduces a Quick Buy button in the Market Insights view, allowing users to quickly purchase assets. The implementation includes:

- Addition of `QUICK_BUY_BUTTON` test ID in `MarketInsightsSelectorsIDs`.
- Updates to the `MarketInsightsView` component to handle Quick Buy interactions, including conditional rendering based on feature flags.
- Integration of `AssetDetailsQuickBuy` for displaying the Quick Buy interface, with analytics tracking for user interactions.
- Tests to ensure the Quick Buy button behaves correctly based on the feature flag state.

This enhancement improves user experience by providing a streamlined purchasing option directly from the Market Insights section.
@github-actions

github-actions Bot commented Jun 3, 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 the team-social-ai Social & AI team label Jun 3, 2026
@github-actions github-actions Bot added the size-M label Jun 3, 2026
@xavier-brochard xavier-brochard marked this pull request as ready for review June 3, 2026 13:17
@xavier-brochard xavier-brochard requested a review from a team as a code owner June 3, 2026 13:17
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 3, 2026
zone-live
zone-live previously approved these changes Jun 3, 2026
…tickyFooter

This commit introduces logic to hide the Quick Buy button in the TokenDetailsStickyFooter component when the account has no eligible swap source. The changes include:

- A new test case to verify the Quick Buy button is not rendered when there are no eligible swap tokens.
- Updates to the component to conditionally render the Quick Buy button based on the eligibility of swap tokens.

This enhancement improves the user experience by preventing the display of an inactive Quick Buy option.

@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 c6c5789. Configure here.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes introduce a new "Quick Buy" feature in MarketInsightsView (feature-flagged) and refactor TokenDetailsStickyFooter's quick buy button visibility logic.

Key impacts:

  1. MarketInsightsView is part of the Trending tab ecosystem → SmokeWalletPlatform (Trending section)
  2. MarketInsights is used in Perps context (PerpsMarketDetailsView imports it) → SmokePerps; per SmokePerps description, also requires SmokeWalletPlatform and SmokeConfirmations
  3. QuickBuy flow triggers on-chain transactions → SmokeConfirmations
  4. TokenDetailsStickyFooter is used in TokenDetails.tsx (asset overview) and contains Swap/Buy buttons; the logic change (showQuickBuyButton now requires hasEligibleSwapTokens) could affect swap button visibility behavior → SmokeSwap

The changes are feature-flagged (selectSocialAiAssetDetailsQuickBuyEnabled), reducing risk of regressions. The footer disclaimer text was also moved (layout change in MarketInsightsView). No changes to navigation, browser, accounts, identity, network, or snaps components.

Performance Test Selection:
The changes are UI feature additions (Quick Buy button in MarketInsightsView, TokenDetailsStickyFooter logic fix) that are feature-flagged. No changes to core rendering performance, data loading, account/network list components, app startup, or performance-critical paths. The changes don't affect any performance test infrastructure.

View GitHub Actions results

@xavier-brochard xavier-brochard added the skip-e2e skip E2E test jobs label Jun 3, 2026
@xavier-brochard xavier-brochard added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 000d79f Jun 4, 2026
344 of 408 checks passed
@xavier-brochard xavier-brochard deleted the tsa-599-quick-buy-entrypoint-market-insights branch June 4, 2026 07:58
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.81.0 Issue or pull request that will be included in release 7.81.0 risk:medium AI analysis: medium risk size-M skip-e2e skip E2E test jobs team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants