feat(ramps-controller): scope-aware in-app provider widening in getQuotes#9353
Draft
saustrie-consensys wants to merge 4 commits into
Draft
feat(ramps-controller): scope-aware in-app provider widening in getQuotes#9353saustrie-consensys wants to merge 4 commits into
saustrie-consensys wants to merge 4 commits into
Conversation
…otes Add an optional `getProviderScope` callback to `RampsControllerOptions` (exported `ProviderScope` = 'off' | 'in-app' | 'all', read per getQuotes call). When the scope is non-'off', the native-only auto-selection path (autoSelectProvider / restrictToKnownOrNativeProviders) widens to every supporting provider and returns the best in-app quote at success[0]. `#pickInAppQuote` drops external-browser (buyWidget.browser 'IN_APP_OS_BROWSER') and custom-action quotes, enforces per-provider fiat limits up front, and orders by reliability then price off `sorted`. It also reuses the existing getProviders hydration fallback so an empty catalog does not silently quote nothing. The default stays native-only, explicit-`providers` callers are untouched, and providers.selected is never mutated. A host can now bump MM Pay's getRampsQuote (which reads success[0]) onto in-app providers with no transaction-pay-controller change.
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
… link - Add tests for the remaining getQuotes/#pickInAppQuote branches to restore the package's 100% coverage: inline isCustomAction exclusion, sort-order fall-through to the first candidate, scope `all` keeping external/custom quotes, restrict-only widening with a fitting limit, and amount-above-max limit skip. - Flatten the CHANGELOG entry so the PR link sits on the top-level bullet (the check-changelog action requires each entry to link to the PR).
Contributor
Author
|
@metamaskbot publish-preview |
…testing REVERT before release. Forces #pickInAppQuote to skip native providers so a non-native in-app WebView provider is the one suggested during physical-device testing of the Phase 1 in-app flow. istanbul-ignored to keep coverage at 100%.
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
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.
Explanation
Part of Headless Buy "all providers" support (Phase 1). Adds an opt-in way for a host to widen
RampsController.getQuotesfrom native-only auto-selection to in-app WebView aggregator providers, with no change to consumers that pass explicit providers.getProviderScopecallback onRampsControllerOptionsplus a new exportedProviderScopetype ('off' | 'in-app' | 'all'). The callback is read pergetQuotescall, so a host toggle takes effect at runtime. Defaults to'off'(today's behaviour) when omitted.off, the native-only auto-selection path (autoSelectProvider/restrictToKnownOrNativeProviders) widens to every supporting provider and returns the single best in-app quote atsuccess[0]. A new private#pickInAppQuotedrops external-browser (buyWidget.browser === 'IN_APP_OS_BROWSER') and custom-action quotes, enforces per-provider fiat limits up front, and orders by reliability then price using the server-providedsortedorder. It reuses the existinggetProvidershydration fallback so an empty catalog cannot silently quote nothing.providerscallers are unaffected, andproviders.selectedis never mutated.This lets a client bump the caller that reads
getQuotes(...).success[0]onto in-app providers behind its own gate, with no other core changes.References
Changelog
See
packages/ramps-controller/CHANGELOG.md.