Skip to content

feat: pass explicit params to RampsController:getQuotes and persist rampsQuote on fiatPayment#8628

Open
OGPoyraz wants to merge 6 commits intomainfrom
ogp/mmpay-fiatquote-modifications
Open

feat: pass explicit params to RampsController:getQuotes and persist rampsQuote on fiatPayment#8628
OGPoyraz wants to merge 6 commits intomainfrom
ogp/mmpay-fiatquote-modifications

Conversation

@OGPoyraz
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz commented Apr 29, 2026

Explanation

The fiat quote flow in transaction-pay-controller was calling RampsController:getQuotes without specifying the asset, provider, or currency - relying on defaults or a hardcoded pickBestFiatQuote helper that filtered for a specific staging provider.

This PR:

  1. Passes explicit parameters to RampsController:getQuotes: assetId (from fiatAsset.caipAssetId), providers (from RampsControllerState.providers.selected.id), and fiat: 'USD'.
  2. Picks the first quote from quotes.success[0] instead of searching by hardcoded provider name via pickBestFiatQuote.
  3. Persists the ramps quote on TransactionFiatPayment.rampsQuote via TransactionPayController:updateFiatPayment so downstream consumers can access it.
  4. Extracts getRampsQuote helper to isolate ramps state reading and quote fetching for readability.
  5. Removes pickBestFiatQuote and the unused FiatQuotesResponse type alias since they are no longer needed.
  6. Adds RampsControllerGetStateAction to allowed actions so the messenger can read ramps controller state.

References

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

Note

Medium Risk
Changes the quote-selection and request parameters for fiat on-ramp quotes and adds persisted quote state, which could affect pricing/provider choice if the selected provider/state is incorrect; test coverage was updated to mitigate.

Overview
Fixes the fiat quote flow to call RampsController:getQuotes with explicit assetId (CAIP asset id), fiat: 'USD', and providers derived from RampsController:getState rather than relying on defaults and a hardcoded provider filter.

The ramps selection logic is simplified to take quotes.success[0], and the chosen ramps quote is now persisted onto per-transaction fiatPayment.rampsQuote via TransactionPayController:updateFiatPayment. Related cleanup removes pickBestFiatQuote/unused type aliases, expands messenger AllowedActions to include RampsController:getState, updates unit tests accordingly, and documents the fix in the package changelog.

Reviewed by Cursor Bugbot for commit 0ef966b. Bugbot is set up for automated code reviews on this repo. Configure here.

OGPoyraz and others added 3 commits April 29, 2026 11:05
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ler:getState

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…tes and persist rampsQuote

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@OGPoyraz OGPoyraz requested a review from a team as a code owner April 29, 2026 09:06
@OGPoyraz OGPoyraz requested a review from a team as a code owner April 29, 2026 09:07
…fications

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@OGPoyraz OGPoyraz force-pushed the ogp/mmpay-fiatquote-modifications branch from 9da8fdd to 0d43e4a Compare April 29, 2026 09:08
Comment on lines +168 to +169
const rampsState = messenger.call('RampsController:getState');
const selectedProviderId = rampsState.providers.selected?.id;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will always be a selected provider as Ramps team mentioned. Even though this is undefined we will pick first quote.

const quotes = await messenger.call('RampsController:getQuotes', {
amount: adjustedAmount,
assetId: fiatAsset.caipAssetId,
fiat: 'USD',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'USD' will be hard lock for MMPay confirmations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if fiat has any effect here as the currency is determined by the region. @saustrie-consensys @pkowalski can check and confirm

Comment on lines +127 to +130
messenger.call('TransactionPayController:updateFiatPayment', {
callback: (fiatPayment) => {
fiatPayment.rampsQuote = fiatQuote;
},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact fiatPayment.rampsQuote will be required to start headless ramps operation in client, hence we will hold this in the fiatPayment state.

@OGPoyraz OGPoyraz changed the title feat: pass explicit params to RampsController:getQuotes and persist rampsQuote on fiat payment feat: pass explicit params to RampsController:getQuotes and persist rampsQuote on fiatPayment Apr 29, 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