feat: sync V2 ramps orders from User Storage - #44367
georgeweiler wants to merge 48 commits into
Conversation
Wire RampsController order syncing so orders created on mobile can be pulled into the extension on unlock, without adding ramps UI. Co-authored-by: Cursor <cursoragent@cursor.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. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (15 files, +344 -12)
👨🔧 @MetaMask/extension-platform (1 files, +2 -1)
👨🔧 @MetaMask/money-movement (8 files, +437 -29)
📜 @MetaMask/policy-reviewers (8 files, +56 -32)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🧪 @MetaMask/qa (2 files, +11 -1)
|
Builds ready [1f54a22]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 0 warn · 🔴 0 fail)
Bundle sizes
|
Match mobile by exposing a Buy & sell orders sub-toggle, and include ramps syncing in the reverse-cascade that disables the main Backup & Sync switch when every sub-feature is off. Co-authored-by: Cursor <cursoragent@cursor.com>
Builds ready [5b063e4]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 0 warn · 🔴 0 fail)
Bundle sizes
|
Required after merging main so RampsController can read moneyHeadlessAllProviders for quote widening alongside order sync. Co-authored-by: Cursor <cursoragent@cursor.com>
Builds ready [bd074e8]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 0 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…into feat/ramps-order-syncing
Open a background Portfolio tab to upload Buy history, re-sign into DEV Profile Sync, sync all HD entropy sources, and prefer the prior provider (with /providers/ id normalize) instead of defaulting to Transak. Co-authored-by: Cursor <cursoragent@cursor.com>
Builds ready [4182484]
⚡ Performance Benchmarks (Total: 🟢 13 pass · 🟡 8 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
This reverts commit 80c62f6.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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 6e9eff7. Configure here.
Builds ready [6e9eff7]
⚡ Performance Benchmarks (Total: 🟢 11 pass · 🟡 10 warn · 🔴 4 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Builds ready [d055491]
⚡ Performance Benchmarks (Total: 🟢 10 pass · 🟡 12 warn · 🔴 3 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
Superseded by a codeowner-aligned five-PR stack:
The original branch is retained as a recoverable reference. |




Description
Delegates User Storage + auth actions to the ramps messenger so
RampsController.syncOrdersWithUserStorage()can run, exposessyncRampsOrdersWithUserStorageon the ramps background API, and pulls remote V2 orders on unlock viauseRampsOrderSyncinginMetamaskIdentityProvider(same gates as account/contact sync).Also adds Backup & Sync Buy & sell orders sub-toggle (
BACKUPANDSYNC_FEATURES.rampsSyncing), silent Portfolio Buy migrate then sync, Profile Sync auth sanitization when switching DEV/PRD backends, and preferred-provider selection from the most recent completed synced order.Changelog
CHANGELOG entry: Added Backup & Sync support for buy and sell order history across MetaMask clients
Related issues
Depends on:
Works with:
Manual testing steps
RampsController.orders/useRampsOrders.Screenshots/Recordings
Before
N/A
After
N/A — no dedicated orders history UI in this PR; synced orders land in existing ramps controller state/hooks.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes buy entry behavior, Profile Sync session handling, and cross-device order sync; mistakes could strand users on wrong auth env or skip/mis-run Portfolio migration, though feature toggles and tests limit blast radius.
Overview
Adds Backup & Sync → Buy & sell orders so V2 buy/sell order history can sync through Profile User Storage, alongside accounts and contacts.
Background wiring:
RampsControllergets User Storage and auth messenger actions, asyncRampsOrdersWithUserStoragebackground API, tracing, and Sentry/MetaMetrics on sync failures. Unlock triggers sync viauseRampsOrderSyncinginMetamaskIdentityProviderwhen the usual gates pass (signed in, B&S on, ramps sync on, etc.).Auth & env: Persisted Profile Sync sessions are cleared on startup when JWT issuer does not match the configured OIDC env (
sanitizePersistedAuthenticationState). Localyarn startuses DEV auth for staging ramps while E2E stays on PRD.Buy flow: Returning Portfolio-connected users no longer default to opening Portfolio for buy when ramps are enabled—they go in-app after optional silent Portfolio migrate (
runPortfolioBuyOrdersMigration: background tab, sign-in, sync, one-time storage flag). Migration runs only when B&S and ramps sync are enabled. Provider auto-selection re-runs when synced completed orders arrive and normalizes/providers/…ids from Portfolio storage.Depends on preview
@metamask/ramps-controllerand@metamask/profile-sync-controllerpackages; LavaMoat policies updated accordingly.Reviewed by Cursor Bugbot for commit d055491. Bugbot is set up for automated code reviews on this repo. Configure here.