Skip to content

chore(ramps): remove UB2 feature flag and legacy buy stack#31768

Merged
amitabh94 merged 19 commits into
mainfrom
cursor/remove-ub2-feature-flag-bb04
Jun 23, 2026
Merged

chore(ramps): remove UB2 feature flag and legacy buy stack#31768
amitabh94 merged 19 commits into
mainfrom
cursor/remove-ub2-feature-flag-bb04

Conversation

@amitabh94

@amitabh94 amitabh94 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

Unified Buy V2 (UB2) is always on in production (TRAM-3559). This PR removes the rampsUnifiedBuyV2 remote feature flag and all V1 fallback paths, deletes the legacy Deposit navigator stack, consolidates remaining Deposit/ code under Ramp/, and removes @consensys/native-ramps-sdk (legacy deposit orders no longer poll; they display last-known Redux state).

Key changes:

  • Delete flag selectors/hooks and always initialize RampsController at Engine startup
  • Route all buy entry points through unified V2 (BuildQuote / TokenSelection)
  • Remove duplicate Deposit screens from navigation; use Ramp/Views/* only
  • Move shared deposit utils, hooks, components, and types into Ramp/
  • Replace SDK types with Ramp/types/legacyDeposit.ts; stop legacy order polling
  • Update unit tests, E2E specs, feature-flag registry, and Engine background-state fixture

Review note

This is an intentionally large cleanup PR . It removes the UB2 flag and the legacy buy/Deposit stack so Ramps runs on a single V2 path.

Why one PR: Flag removal and legacy stack removal need to land together. A split merge leaves a dual-stack middle state (two routing models, two test matrices, two places for bugs). We are finishing the UB2 rollout in one atomic step.

Why this matters:

  • One buy UX — Design and PM align on V2 only; no more updating unused legacy screens/components "just in case."
  • Smaller maintenance surface — Fewer routes, page objects, mocks, and feature-flag branches for every Ramps change.
  • Less bug surface — No "V2 flag on but V1 path still reachable" or deeplink/routing drift between stacks.
  • Bundle / codebase weight — Meaningful deletion of dead paths (net reduction in code we ship and support).
  • Faster follow-up work — Provider, deeplink, KYC, and analytics changes touch one stack, not two.

Expected user impact: Low for users already on UB2 (production default). Behavioral change is removing the unused fork, not redesigning buy.

Suggested review focus (if time is limited):

  1. Buy/deeplink routing (handleRampUrl, ramp routes)
  2. Remaining legacy entry points after flag removal
  3. Test/E2E alignment (V1 assumptions removed)
  4. Order/details paths affected by Deposit → Ramp consolidation

Review on a PR this size is appreciated — happy to walk through structure if useful.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3559

Manual testing steps

Feature: Unified Buy V2 always enabled

  Scenario: user opens buy from wallet fund menu
    Given the app is unlocked on mainnet with a funded account
    When user taps Buy from the wallet fund menu
    Then BuildQuote or TokenSelection opens via the unified buy flow
    And no legacy aggregator buy fallback is shown

  Scenario: legacy deposit order displays without live polling
    Given a persisted legacy DEPOSIT fiat order exists in order history
    When user opens that order's details
    Then order details render from last-known Redux state

  Scenario: buy deeplink routes to unified flow
    Given the app is unlocked
    When user opens a ramps buy deeplink
    Then navigation lands on the unified buy flow (not legacy Deposit stack)

Screenshots/Recordings

N/A — internal cleanup and dead-code removal; no intentional user-visible UI change.

Before

N/A

After

All testing has been done on RC builds generated from this branch, using real funds in production. Build tested: 8.1.0 (5631).

Transak Order

trim.3CA4848F-AA89-4E5B-9975-DBE82F58D964.MOV
Transak order screenshot

Coinbase Order

trim.0623273C-7B94-4FEB-92F6-08688DB0D5CC.MOV
Coinbase order screenshot

Moonpay Order

trim.78A4480F-7CD0-420D-B931-A3289403AB0B.MOV
MoonPay order screenshot

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

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

High Risk
Large routing and navigation refactor across buy/deposit entry points, order history, and deleted legacy flows; wrong wiring could strand users or break legacy order display.

Overview
Removes the Unified Buy V2 feature flag and all V1 buy/deposit routing so every “add funds” / buy entry point goes through goToBuy and analytics always tags UNIFIED_BUY_2.

Navigation: Drops the DepositRoutes stack from MainNavigator; DepositOrderDetails moves under Ramp/Views/OrderDetails (legacy order history only). In-progress deposit orders in CREATED state now resume via goToBuy() instead of goToDeposit().

Code deletion / consolidation: Deletes the legacy Ramp/Deposit/ navigator screens (e.g. BuildQuote, BankDetails, BasicInfo, KYC flows) and related tests; relocates shared pieces (e.g. depositUtils, DepositDateField, network filters) into Ramp/. Types that lived on @consensys/native-ramps-sdk shift to Ramp/types/legacyDeposit (and related legacy navigation types).

UX cleanup: Removes aggregator settings paths to “more ways to buy” / legacy deposit; ramp settings region UI is V2-only (change region, no legacy reset). useMusdCtaVisibility tests align with useRampsTokens instead of the old ramp-token + flag matrix.

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

Unified Buy V2 (UB2) is now always enabled. Remove the remote feature
flag, selector, hooks, and all conditional V1 fallbacks across ramp
navigation, deeplinks, order notifications, token buyability, and
analytics. RampsController now initializes unconditionally at startup.

Update unit tests, E2E fixtures, feature-flag registry, and docs to
match the simplified always-on behavior.

Co-authored-by: Amitabh Aggarwal <amitabh94@users.noreply.github.com>
@metamask-ci metamask-ci Bot added team-money-movement issues related to Money Movement features INVALID-PR-TEMPLATE PR's body doesn't match template labels Jun 15, 2026
- Remove goToDeposit and Deposit stack from MainNavigator; UB2 buy flow
  uses Ramp/Views routes exclusively
- Delete legacy Deposit Views, routes, hooks, and SDK wiring that duplicated
  the UB2 NativeFlow screens
- Keep shared Deposit utilities (styles, components, orderProcessor,
  DepositOrderDetails) still used by Ramp/Views/NativeFlow
- Extract transakNativeForms and legacyNavigation types; route modals via
  Routes.RAMP.MODALS
- Update tests and remove obsolete DepositPhoneField/StateSelector wrappers

Co-authored-by: Amitabh Aggarwal <amitabh94@users.noreply.github.com>
cursoragent and others added 2 commits June 16, 2026 17:36
- Remove app/components/UI/Ramp/Deposit/ entirely
- Move shared code to Ramp/constants, hooks, utils, components, sdk,
  testUtils, assets, and types
- Co-locate NativeFlow styles under Views/NativeFlow/
- Move SsnInfoModal to Views/Modals and DepositOrderDetails to
  Views/OrderDetails
- Delete dead Deposit orphans (duplicate TruncatedError, unused hooks,
  orphan style files, legacy SDK provider)
- Update all import paths across Ramp, Card, TokenDetails, Auth, and Nav

Co-authored-by: Amitabh Aggarwal <amitabh94@users.noreply.github.com>
Drop @consensys/native-ramps-sdk from package.json and inline legacy deposit
types locally. Legacy DEPOSIT orders no longer poll via NativeRampsSdk.getOrder;
they retain last-known Redux state like other static providers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@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.

Merge origin/main into UB2 removal branch. Resolve Checkout and
Authentication.test conflicts, regenerate yarn.lock, and redirect
Ramp/Deposit/types/analytics imports to Ramp/types/depositAnalytics.

Co-authored-by: Cursor <cursoragent@cursor.com>
@socket-security

socket-security Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​bitcoin-wallet-standard@​1.0.0 ⏵ 1.1.075 +110099 +192100
Updatednpm/​@​metamask/​seedless-onboarding-controller@​10.0.1 ⏵ 10.0.2991007897 +1100
Updatednpm/​@​metamask/​tron-wallet-snap@​1.27.0 ⏵ 1.28.010010096100 +1100

View full report

Co-authored-by: Cursor <cursoragent@cursor.com>
Use interfaces in transakNativeForms for eslint, restore card provider
type field lost in merge, and update RampsController fixture for countries
loading state when init runs at Engine startup.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve useDepositEnabled conflict using shared hasMinimumRequiredVersion
helper from main while keeping Ramp/ consolidated import paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@amitabh94 amitabh94 changed the title Remove rampsUnifiedBuyV2 (UB2) feature flag and legacy buy paths chore(ramps): remove UB2 feature flag and legacy buy stack Jun 22, 2026
@amitabh94 amitabh94 added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed Run smoke E2E QA Passed QA testing has been completed and passed labels Jun 22, 2026
@metamask-ci metamask-ci Bot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 22, 2026
@amitabh94 amitabh94 marked this pull request as ready for review June 22, 2026 05:32
@amitabh94 amitabh94 requested review from a team as code owners June 22, 2026 05:32
vinnyhoward
vinnyhoward previously approved these changes Jun 23, 2026
V2 amount input shows $ prefix, not literal USD text. Match on-network
subtitle instead.

Co-authored-by: Amitabh Aggarwal <amitabh94@users.noreply.github.com>
weitingsun
weitingsun previously approved these changes Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚡ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

3 tests failed · 20 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

❌ Failed Tests (3)

@Accounts-team

Test Platform Device Reason Recording
Import SRP with +50 accounts, SRP 1, SRP 2, SRP 3 Android Google Pixel 8 Pro (v14.0) Test error 📹 Watch

@metamask-mobile-platform

Test Platform Device Reason Recording
Cold Start after importing a wallet Android Google Pixel 8 Pro (v14.0) Test error 📹 Watch

@metamask-onboarding-team

Test Platform Device Reason Recording
Account creation after fresh install Android Google Pixel 8 Pro (v14.0) Test error 📹 Watch
✅ Passed Tests (17)
Test Platform Device Duration Team Recording
Asset View, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 3.01s @assets-dev-team 📹 Watch
Aggregated Balance Loading Time, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 9.04s @assets-dev-team 📹 Watch
Cross-chain swap flow - ETH to SOL - 50+ accounts, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 4.62s @swap-bridge-dev-team 📹 Watch
Cold Start: Measure ColdStart To Login Screen Android Google Pixel 8 Pro (v14.0) 3.61s @metamask-mobile-platform 📹 Watch
Swap flow - ETH to LINK, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 3.02s @swap-bridge-dev-team 📹 Watch
Measure Warm Start: Login To Wallet Screen Android Google Pixel 8 Pro (v14.0) 2.13s @metamask-mobile-platform 📹 Watch
Measure Warm Start: Warm Start to Login Screen Android Google Pixel 8 Pro (v14.0) 1.16s @metamask-mobile-platform 📹 Watch
Perps add funds Android Google Pixel 8 Pro (v14.0) 9.60s @mm-perps-engineering-team 📹 Watch
Predict Available Balance - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 1.90s @team-predict 📹 Watch
Predict Market Details - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 9.59s @team-predict 📹 Watch
Predict Deposit - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 14.85s @team-predict 📹 Watch
Connect to Uniswap dapp, edit accounts, choose another account, and skip Solana popup Android Google Pixel 8 Pro (v14.0) 19.01s @metamask-mobile-platform 📹 Watch
Measure Cold Start To Onboarding Screen Android Google Pixel 8 Pro (v14.0) 3.01s @metamask-mobile-platform 📹 Watch
Onboarding Import SRP with +50 accounts, SRP 3 Android Google Pixel 8 Pro (v14.0) 5.92s @metamask-onboarding-team 📹 Watch
Perps open position and close it Android Google Pixel 8 Pro (v14.0) 23.14s @mm-perps-engineering-team 📹 Watch
Seedless Onboarding: Apple Login New User Android Google Pixel 8 Pro (v14.0) 13.13s @metamask-onboarding-team 📹 Watch
Seedless Onboarding: Google Login New User Android Google Pixel 8 Pro (v14.0) 10.42s @metamask-onboarding-team 📹 Watch

Branch: cursor/remove-ub2-feature-flag-bb04 · Build: Normal · Commit: 4a8f3d7 · View full run

The spec targeted legacy buy UI and lacked V2 quote mocks; V2 routing is covered by handleRampUrl unit tests and onramp-unified-buy smoke.

Co-authored-by: Cursor <cursoragent@cursor.com>
@amitabh94 amitabh94 added the skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found

All E2E tests pre-selected.

View GitHub Actions results

Comment thread tests/feature-flags/feature-flag-registry.ts
@sonarqubecloud

Copy link
Copy Markdown

@amitabh94 amitabh94 added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit 85e9553 Jun 23, 2026
223 of 224 checks passed
@amitabh94 amitabh94 deleted the cursor/remove-ub2-feature-flag-bb04 branch June 23, 2026 14:46
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 23, 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 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed QA Passed QA testing has been completed and passed release-8.1.0 Issue or pull request that will be included in release 8.1.0 Run smoke E2E size-XL skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.