-
-
Notifications
You must be signed in to change notification settings - Fork 267
feat(ramps-controller): add quotes functionality #7747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+1,649
−3
Conversation
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
Add support for fetching quotes from multiple providers via the V2 orders API. - Add `getQuotes()` method to RampsService to call GET /v2/orders/all/quotes - Add `getQuotes()` method to RampsController with caching and state defaults - Add `getWidgetUrl()` helper to extract widget URL from a quote - Add `triggerGetQuotes()` fire-and-forget method for React effects - Add `quotes` state property to store fetched quotes - Add Quote, QuotesResponse, GetQuotesParams, and related types - Export new types from index.ts
bccee41 to
1b07732
Compare
- Add redirectUrl to quotes cache key to prevent incorrect caching - Fix array mutation by copying before sort in cache key - Clear quotes state on region change in setUserRegion and cleanupState - Rename err to error in QuoteError type (lint: restricted identifier) - Fix prettier formatting
- Add redirectUrl parameter to quotes API request - Add validation for amount, assetId, and walletAddress - Set 15s default TTL for quotes (time-sensitive data) - Simplify CHANGELOG entry per reviewer feedback
- Fix race condition in getQuotes by checking region matches before updating state - Add complete response validation for all required QuotesResponse fields - Add comprehensive tests for both fixes
Resolve merge conflicts from PR #7734 which renamed preferredProvider to selectedProvider and added selectedToken functionality. Changes: - Merge imports: Add RampsToken along with QuotesResponse, Quote, GetQuotesParams - State already updated from main: selectedProvider and selectedToken - All tests passing with 100% coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
pkowalski
approved these changes
Jan 29, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 30, 2026
…7793) ## Summary Fixes a bug in `getQuotes()` where `assetId` and `walletAddress` were validated to not be empty/whitespace but the untrimmed values were used in the cache key and sent to the API. This could cause issues if values with leading/trailing spaces were passed. ## Changes - Normalize `assetId` and `walletAddress` by trimming them after validation - Use normalized values consistently in cache key and params sent to API - Add test to verify trimming behavior works correctly ## Test plan - All existing tests pass - New test added to verify assetId and walletAddress are trimmed before being sent to the service ## Related Follow-up fix to #7747 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: small normalization change limited to `getQuotes` plus a targeted unit test; main impact is cache key/param normalization which could change caching behavior for inputs with whitespace. > > **Overview** > Fixes `RampsController.getQuotes` to **trim** `assetId` and `walletAddress` after validation and then use the normalized values consistently in the request `cacheKey` and service params. > > Adds a unit test covering whitespace-trim behavior and records the fix in `CHANGELOG.md`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d6ec3a2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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
The RampsController needs the ability to fetch quotes from multiple providers. This PR adds quotes functionality to consume the new V2 orders API endpoint (
GET /v2/orders/all/quotes).Changes:
RampsService:
Quote,QuoteError,QuoteSortBy,QuoteSortOrder,QuoteCryptoTranslation,QuoteCustomAction,QuotesResponse, andGetQuotesParamsgetQuotes()method that calls the V2 orders API endpoint with support for multiple payment methods, provider filtering, and redirect URLsRampsController:
quotesstate property to store fetched quotesgetQuotes()method with caching support that uses region/fiat/paymentMethods from state if not providedgetWidgetUrl(quote)helper method to extract the widget URL from a quote for redirect providerstriggerGetQuotes()fire-and-forget method for React effectsExports:
This enables two key user stories:
Checklist
Note
Medium Risk
Introduces a new external API integration and new state (
quotes) with caching/normalization logic, which can affect UI behavior and request freshness if parameters or TTL are wrong. No authentication or sensitive data handling changes beyond sending wallet addresses as request params.Overview
Adds multi-provider quotes support end-to-end:
RampsService#getQuotescalls the newGET /v2/orders/all/quotesendpoint (supporting multiplepayments, optionalprovidersfilter, optionalredirectUrl, and buy/sell viaaction) and validates the response shape.Updates
RampsControllerto trackquotesin state (cleared on region changes), addsgetQuoteswith parameter validation + short (15s) request caching, atriggerGetQuotesfire-and-forget helper, and agetWidgetUrlhelper for redirect-provider quotes.Wires the new messenger action type
RampsService:getQuotes, exports the new quote-related types fromindex.ts, and adds comprehensive unit tests plus a changelog entry.Written by Cursor Bugbot for commit 6288925. This will update automatically on new commits. Configure here.