feat: normalize assetId for Ramps API & aut provider switch gate fix cp-7.74.0#29037
Conversation
|
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. |
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.
Reviewed by Cursor Bugbot for commit dd6bd6e. Configure here.
|
I see this PR fixes 2 bugs, are they required to be delivered in the same piece of code? I left a question about Nº1 in the dev channel https://consensys.slack.com/archives/C09J8LBSR9Q/p1776691101815109 |
They are not required as part of the same code, but they do solve the same underlying issue. |
|
I will approve this after you add |
I've added this. |
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: wachunei <1024246+wachunei@users.noreply.github.com>
Resolved in 57e89fc. There was one conflict in |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes affect the core ramp quote-building flow and payment methods fetching. The functional behavior change (auto-switch now always active) and the asset ID normalization fix both need E2E validation via SmokeRamps tests. No other feature areas are impacted - no shared navigation, modals, or controllers are touched. Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
Fixes two issues that prevented non-EVM (Solana) tokens from working in the Buy flow and caused unnecessary friction when switching between tokens:
1. Case-sensitive assetId mismatch for non-EVM tokens
useRampsPaymentMethodswas blanket-lowercasingselectedToken.assetIdbefore passing it to/payments, andBuildQuotewas forwarding the raw controller-stateassetIdinto/quotes. The blanket lowercase was originally added in #28399 to normalize EVM EIP-55 checksummed hex addresses (which the server stores lowercase), but it mangles CAIP-19 references from namespaces where case is significant — notably Solana (base58 mint addresses). With a lowercased mint, the server's strict-equality crypto filter inRegionsV2Servicereturned zero matches and short-circuited topayments: [], so every Solana token appeared to have no payment methods.This PR introduces
normalizeAssetIdForApiwhich only lowercases when the CAIP-19 namespace iseip155:, preserving case for non-EVM namespaces (solana,bip122, …). It's wired into bothuseRampsPaymentMethodsand BuildQuote'squoteFetchParams, so the EVM normalization from #28399 still applies while non-EVM asset IDs pass through verbatim. Wiring/quotessymmetrically also closes a latent version of the same EVM bug on the quotes endpoint that #28399 only patched for/payments.2. "Token Not Available" modal blocked manual-provider users from switching tokens
When the selected token wasn't supported by the current provider, the BuildQuote auto-switch effect was gated on
providerAutoSelected— it only silently switched to a supporting provider if the current provider had been system-picked. A user who had manually chosen (e.g.) Transak and then navigated back to token selection and picked a Solana token got the "Token Not Available" modal even when another provider (e.g. Coinbase) supported the token.The gate is removed. The auto-switch effect now runs whenever
isTokenUnavailablefires and the modal only appears when no provider supports the token. Manual provider picks remain sticky for any token the provider can actually serve, because the effect still early-returns when!isTokenUnavailable.Changelog
CHANGELOG entry: Fixed empty payment methods and false "Token Not Available" modal for Solana and other non-EVM tokens in the Buy flow; a manually-selected provider now silently switches to a supporting provider when the selected token isn't supported, instead of blocking the user with the unavailability modal.
Related issues
Fixes: TRAM-3463
Manual testing steps
Screenshots/Recordings
Before
ScreenRecording_04-17-2026.10-29-25_1.1.MP4
After
provider-selection.mp4
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
Note
Medium Risk
Behavior changes in the Buy (Ramps) flow around provider selection and API request parameters could affect quote/payment-method fetching and navigation to the token-unavailable modal if edge cases weren’t covered.
Overview
Fixes Buy-flow failures for non-EVM tokens by introducing
normalizeAssetIdForApiand using it when calling the Ramps/paymentsand/quotesAPIs, lowercasing onlyeip155:assetIds while preserving case for namespaces like Solana.Changes the token-unavailable handling on
BuildQuoteto auto-switch to another supporting provider regardless of whether the current provider was auto- or manually-selected, only showing the "Token Not Available" modal when no provider supports the token, and updates/extends tests to cover these scenarios.Reviewed by Cursor Bugbot for commit 57e89fc. Bugbot is set up for automated code reviews on this repo. Configure here.