Skip to content

Fix provider auto-selection when initial provider has no quote (TRAM-4119) - #11601

Closed
matteyusys wants to merge 2 commits into
mainfrom
cursor/fix-banxa-autoselect-no-quote-cf59
Closed

matteyusys wants to merge 2 commits into
mainfrom
cursor/fix-banxa-autoselect-no-quote-cf59

Conversation

@matteyusys

Copy link
Copy Markdown
Contributor

Explanation

The extension's quote flow would auto-select a provider (e.g., Banxa) based on order history or availability, but if that provider timed out or returned no quote, the selection remained stuck on that provider even when other providers (like Coinbase and MoonPay) successfully returned quotes. This caused the Continue button to be disabled because the selected provider had no usable quote.

This PR fixes the issue by automatically switching to the best available quote's provider when the originally auto-selected provider fails to return a quote. The fix:

  • Detects when an auto-selected provider has no quote in the returned QuotesResponse (error, timeout, or not in success array)
  • Selects the best alternative provider based on reliability ranking (fallback to price, then first available)
  • Keeps the selection marked as auto-selected for consistent UX
  • Never overrides manual provider selections to preserve user intent

The reselection logic is called at the end of getQuotes before returning, ensuring any consumer of the method benefits from the fix without needing changes.

References

  • Fixes TRAM-4119

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
Open in Web Open in Cursor 

…4119)

When an auto-selected provider (e.g., Banxa) times out or returns no quote,
the controller now automatically switches to the best available quote's
provider while keeping the selection marked as auto-selected.

Manual provider selections are never overridden to preserve user intent.

- Add #reselectProviderIfAutoSelectedHasNoQuote method to detect and handle
  auto-selected providers with no usable quote
- Add #pickBestQuoteForReselection to select the best provider based on
  reliability/price sort order
- Comprehensive test coverage for error, timeout, empty-quote, and manual
  selection cases

Co-authored-by: Matt I. <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🛑 Files requiring codeowner review

To merge this PR, you'll need to get approvals from the following owners.

@MetaMask/money-movement (3 files)
  • packages/ramps-controller/CHANGELOG.md
  • packages/ramps-controller/src/RampsController.test.ts
  • packages/ramps-controller/src/RampsController.ts

ℹ️ Files co-owned by @MetaMask/core-platform (expand for more)

[!NOTE]
For convenience in maintaining this repo, @MetaMask/core-platform co-owns
the following files. It is not required to seek approval from
@MetaMask/core-platform to change these files. This section is purely
informational.

  • packages/ramps-controller/CHANGELOG.md

Remove verbose documentation and explanatory comments from the
reselection methods, keeping only essential information consistent
with the surrounding code style.

Co-authored-by: Matt I. <[email protected]>

Copy link
Copy Markdown
Contributor Author

Moved to #11673 (branch fix/tram-4119).

@matteyusys matteyusys closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants