fix(ramps): Refresh providers on app unlock and separate provider list by token support#27958
Conversation
|
I approved as it looks to make sense and the videos look good though I lack 100% context. Would be good to have a sanity check by George or Pedro |
isn't this a weird check to make, what is the API convention here? In my opinion the only case for the asset to be supported is when |
good @wachunei the reason we can not treat undefined the same as false here is that supportedCryptoCurrencies is a cached map, not a live API response. It comes from the /providers endpoint that was cached and persisted across sessions. mobile can have the old cached providers, that missed tokens, then /payments, and /quotes endpoints return valid data for it - then that shows immediate "No payment methods" without call the endpoint. |
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.
c95dee4 to
6b8594c
Compare
6b8594c to
0118ed1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27958 +/- ##
==========================================
+ Coverage 82.59% 82.63% +0.03%
==========================================
Files 4843 4855 +12
Lines 124595 125081 +486
Branches 27777 27921 +144
==========================================
+ Hits 102914 103361 +447
- Misses 14598 14603 +5
- Partials 7083 7117 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…d-for-unknown-tokens
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes directly affect the on-ramp/off-ramp (buy/sell crypto) flows - specifically provider selection, quote fetching conditions, and provider list display. The No other feature areas are affected - there are no changes to shared navigation, Engine, controllers, confirmations, or other wallet features. The changes are self-contained within the Ramp UI components and hooks. Performance Test Selection: |
wachunei
left a comment
There was a problem hiding this comment.
This looks good to me. @georgeweiler please review as well so you are aware of this top level request
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
Fixed a bug where selecting a provider for some token (e.g. MUSD on Linea) would instantly show "No payment methods are available" because the provider's cached
supportedCryptoCurrenciesmap was stale and didn't include the token.Root cause: The providers data (
supportedCryptoCurrencies) was persisted across sessions and only refreshed on region change or fresh install. For tokens added to the backend after the user's last provider cache update, the map wouldn't include the token, causing the payment methods query to be disabled and the "Token Not Available" modal to show — even though the API supports it.Evidence from reporter's state logs (v7.71.0 build 4173):
eip155:59144/erc20:0xaca92e438df0b2401ff60da7e4337b687a2435da) wasNOT IN MAPfor all 11 providers/providersendpoint already includes MUSD Linea for Transak and MercuryoFix:
queries/providers.ts+useRampsProviders: added a react-query wrapper forgetProviderswithstaleTime: 15minandrefetchOnMount: true. Providers (includingsupportedCryptoCurrencies) are refreshed when data is stale (>15min) and a component usinguseRampsProvidersmounts (e.g. after password unlock or entering the buy flow). On app restart, react-query cache is empty so the first mount always fetches fresh data. The query callsgetProviders(regionCode, { forceRefresh: true })to bypass the controller's internal cache.ProviderSelectionModal: skip quotes fetch whenselectedPaymentMethodis null (prevents API error "Payment methods are required"), and setshowQuotes=falseso no "No providers available" error is shownProviderSelection: when quotes are not available, fall back to separating providers bysupportedCryptoCurrencies— supported tokens on top, others under "Other options"Companion fix in core: George's
feat: removes provider and token persistence in ramps controller(#8307) setspersist: falsefor providers and tokens so stale data won't survive across app restarts. The react-query refresh complements this by also catching stale data within long-running sessions.Changelog
CHANGELOG entry: Fixed payment methods and provider availability for newly added tokens by refreshing providers via react-query (15min TTL) on mount and separating the provider list by token support
Related issues
Fixes: TRAM-3383
Manual testing steps
Screenshots/Recordings
Before
ScreenRecording_03-25-2026.08-46-14_1.1.MP4
After
Payment methods query fires and returns results from the API.
Screen.Recording.2026-03-26.mp4
Screen.Recording.2026-03-26.063000.mp4
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk due to new react-query-driven provider refetching and conditional quote fetching logic that can change network request patterns and provider ordering in the buy flow.
Overview
Prevents stale
supportedCryptoCurrenciesfrom breaking buy flows by adding a react-queryprovidersquery (15minstaleTime,refetchOnMount,forceRefresh) and wiring it intouseRampsProviders(triggered whenregionCodeis available).Tightens “token unavailable” and provider selection behavior:
BuildQuotenow treats missing entries insupportedCryptoCurrenciesas unsupported,ProviderSelectionModalskips quote fetching and disables quote UI whenselectedPaymentMethodisnull, andProviderSelectiongroups providers into supported vs unsupported (with an “Other options” separator) when quotes aren’t shown/available.Adds/updates unit tests for the new query options, provider grouping, quote-fetch gating, and the token-unavailable edge case.
Written by Cursor Bugbot for commit 707342f. This will update automatically on new commits. Configure here.