feat(ramp): consume JSON moneyHeadlessAllProviders payload + thread rampSurface into headless getQuotes - #33362
Conversation
|
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
…r fetch On a region switch RampsController clears providers to [] (persist:false) and refetches, a window that can last ~24s on a cold switch (observed in NY). The Money Add-funds gate keyed the Deposit row on regionHasProviderForAsset, which returns false for an empty list, so the entry vanished for the whole fetch even in regions that do offer fiat. useRegionHasFiatProvider now treats "widening on + still loading + nothing fetched yet" as available, resolving to the real asset-aware answer once providers arrive. Gated on the flag so the production native-only default is unchanged.
The hook stopped meaning "has a native provider" once it became flag-aware: with moneyHeadlessAllProviders on it returns true for aggregator and external-browser/custom-action providers (PayPal, Coinbase), not just native. Rename the hook, its file, and its consumers, and correct the stale "native-only for v0" docstring on useIsFiatPaymentAvailable. Pure rename plus doc fix; no behavior change.
…lds resolve the lockfile The type:non-breaking preview overlay rewrote the @metamask/ramps-controller@npm:^17.0.0 descriptor out of the lockfile, so it only resolved when the preview-builds plugin re-applied the remap at runtime. The iOS RC build's CocoaPods/autolinking install does not apply that remap, so it failed with 'not present in your lockfile' (run 29539668587). type:breaking keeps the ^17.0.0 descriptor in the lockfile (the app still resolves to the preview) so autolinking resolves cleanly; matches how the Phase 1 branch RC-built.
…lback REVERT BEFORE MERGE - testing unblock only, real fix belongs in core. With assetsUnifyState enabled, AssetsController:getStateForTransactionPay only carries prices for assets the account holds, so getTokenFiatRate returns undefined for the deposit's required token (e.g. Arbitrum USDC for a Perps deposit) and buildRequiredToken drops it. Both the crypto and fiat payment routes then die before quoting and the confirmation shows the blocking no_payment_route_available alert. Patch: in getTokenFiatRate, when a token is in the STABLECOINS list but has no market data entry, peg usdRate to 1 and derive fiatRate from the chain's native currency rates instead of returning undefined. Known stablecoins with market data, other tokens, and natives are unchanged.
useHeadlessAllProvidersEnabled now validates the payload's minimumVersion through the shared validatedVersionGatedFeatureFlag util and inherits the core contract's featureVersion requirement; consumes ramps-controller preview 17.0.0-preview-40d5fb1e2 carrying the new helpers (TEMP pin, swap for the released 17.1.0 before merge).
adb6af7 to
03b4221
Compare
…tale surface-mapping tests
…lag-aware provider logic
…ype gap bridge-controller v77 (installed at top level, used by app selectors) has `string | null` in TokenAmountValues, while bridge-status-controller v74 was compiled against bridge-controller v78 which uses plain `string`. This makes the spread quote object structurally incompatible with submitTx at the type level even though the values are runtime-equivalent. Use a typed double-cast (`as unknown as SubmitTxQuoteArg`) to bridge the declared type mismatch.
…77/v78 type gap" This reverts commit bbbc1ff.
…ontroller v78 type skew
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 97ac9b9. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
weitingsun
left a comment
There was a problem hiding this comment.
platform CO files LGTM
jpuri
left a comment
There was a problem hiding this comment.
Changes to confirmation owned files looks ok.




Description
Phase 2 of Headless Buy all-providers needs QA to force a specific provider mix (for example external-browser-only) with only a LaunchDarkly edit. MetaMask/core#9524 widens the
moneyHeadlessAllProvidersflag's value contract so the same key also accepts a JSON payload{ "enabled": true, "providerIds": [...] }; when provider ids are listed, the controller's widened quote pick drops candidates whose provider is not listed. Old clients coerce the payload tofalse(native-only), and production servesfalseeverywhere, so serving it cannot enable widening for a client that cannot parse it.This PR is the mobile half:
@metamask/ramps-controllerto consume the new contract. No mobile flag-interpretation logic is added:useHeadlessAllProvidersEnabledstill delegates to the core helper, so the object form flows through the existing UI availability gates automatically.Plan doc:
app/components/UI/Ramp/headless/PLAN_-_ALL_PROVIDERS_SUPPORT.md, milestone P2.M5 (revision in #32906 records the single-flag JSON design).Changelog
CHANGELOG entry: null
Related issues
Refs: MetaMask/core#9524
Manual testing steps
money-headless-all-providersto{ "enabled": true, "providerIds": ["/providers/<external-browser-provider>"] }in a region where an in-app aggregator normally wins on reliability.true(or removeproviderIds) and confirm selection reverts to the reliability winner.false(or{ "enabled": false }) and confirm the flow is native-only again.Screenshots/Recordings
Before
N/A (dev/QA-gated quoting behavior; no UI change)
After
Had to allow temporarily fiat transactions in Perps in my local RC, but here's an example of perps allowing Coinbase
ScreenRecording_07-23-2026.10-26-43_1.MP4
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Touches MM Pay fiat availability and region gating behind a feature flag, with a short “optimistic available” window during provider fetch that could briefly show deposit UI before resolving.
Overview
Bumps
@metamask/ramps-controllerto ^18.0.0 so mobile picks up the updatedmoneyHeadlessAllProviderscontract (JSON payload withfeatureVersion: '1'andenabled: true, plus optionalproviderIdshandled in core).useHeadlessAllProvidersEnabledstill delegates to core’sisHeadlessAllProvidersEnabled; tests now cover enabling object payloads, rejecting stale/malformed values, and keeping local override behavior.Renames
useHasNativeFiatProvidertouseHasFiatProviderand updates MM Pay gates (useIsFiatPaymentAvailable, mocks) so naming/docs match flag-aware availability (native-only when the flag is off, any provider class when on).Fixes a cold provider fetch regression in
useRegionHasFiatProvider: when all-providers widening is on and the catalog is still loading with an empty list after a region switch, the hook temporarily treats the region as available so add-funds entry does not disappear until providers load.Docs/comments only elsewhere (
useRampsBuyLimits,useFiatConfirmnotes thatrampSurfaceis analytics-only).Reviewed by Cursor Bugbot for commit 00d1fd2. Bugbot is set up for automated code reviews on this repo. Configure here.