feat(ramp): consume JSON moneyHeadlessAllProviders payload + thread rampSurface into headless getQuotes#33362
Draft
saustrie-consensys wants to merge 5 commits into
Draft
feat(ramp): consume JSON moneyHeadlessAllProviders payload + thread rampSurface into headless getQuotes#33362saustrie-consensys wants to merge 5 commits into
saustrie-consensys wants to merge 5 commits into
Conversation
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. |
4 tasks
Contributor
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. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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": [...], "surfaces": { "money": [...], "perps": [...], "predictions": [...] } }; 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.rampSurfacethrough the headlessgetQuotesparams (HeadlessGetQuotesParams,useHeadlessBuy,GetQuotesOptions), mapped from theramp_surfaceanalytics vocabulary onto the payload's surface keys (money_accounttomoney,perpstoperps,predictiontopredictions), so a per-surface allowlist applies to quote requests tagged with a surface.Note:
surfacesentries only affect callers that pass a surface tag, and no shipped widened caller does yet (TPCgetRampsQuotepasses none), so MM Pay money deposits are governed by the payload's top-levelproviderIdslist. That list is sufficient for the Phase 2 QA forcing scenario; threading a surface through TPC is a follow-up tracked with P2.M6.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
N/A (dev/QA-gated quoting behavior; no UI change)
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