fix(ramps-controller): skip payment methods fetch when token is unsupported by provider#8103
Open
fix(ramps-controller): skip payment methods fetch when token is unsupported by provider#8103
Conversation
…ported by provider When setSelectedProvider is called, avoid fetching payment methods if the selected token is explicitly not supported by the new provider (according to supportedCryptoCurrencies). Fetching with an unsupported token causes the API to return empty results for the wrong reason, leaving the user with no payment methods and no feedback. The UI's Token Not Available modal handles this case instead.
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.
…rencies check and add changelog entry Use !== false instead of === true so that tokens absent from the map are treated as supported (blocklist, not allowlist).
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.
Summary
setSelectedProvider, skip thegetPaymentMethodsfetch when the selected token is explicitly not supported by the new provider (based onsupportedCryptoCurrencies)assetId, causing the API to return empty results — leaving the user with no payment methods and no feedbackHow it works
supportedCryptoCurrenciesis treated as a blocklist hint: if the field is absent or doesn't explicitly exclude the token, we fetch as usual. Only skip whensupportedCryptoCurrencies[assetId]is explicitlyfalse.Test plan
Note
Low Risk
Low risk: a small guard in
setSelectedProviderto avoid an unnecessarygetPaymentMethodscall based on provider metadata, covered by targeted unit tests. Main risk is behavioral change ifsupportedCryptoCurrenciesdata is incomplete or incorrect.Overview
Prevents
setSelectedProviderfrom fetching payment methods when the currently selected token is explicitly unsupported by the newly selected provider (viaprovider.supportedCryptoCurrencies[assetId] === false), avoiding misleading empty payment-method state.Adds unit tests for the new skip/fetch conditions (unsupported token, supported token, and missing
supportedCryptoCurrenciesfield) and documents the fix in theramps-controllerchangelog.Written by Cursor Bugbot for commit d222a3a. This will update automatically on new commits. Configure here.