feat: Implement FiatStrategy submit flow with order polling and relay execution#8347
feat: Implement FiatStrategy submit flow with order polling and relay execution#8347
FiatStrategy submit flow with order polling and relay execution#8347Conversation
| /** Order identifier - `orderCode` specifically used as RampsService:getOrder parameter in normalized format (/providers/{provider}/orders/{id}). */ | ||
| orderCode?: string; |
There was a problem hiding this comment.
Originally we talked Ramps team to add metadata into fiat orders and also filtering mechanism.
Due to limitation of timeframe this may not be option to deliver besides headless ramp, hence we are adding orderCode (meaning order id) into TransactionFiatPayment
There was a problem hiding this comment.
Minor, orderId or rampsId to be more generic?
There was a problem hiding this comment.
Done - renamed to orderId
| .filter((singleRequest) => { | ||
| const hasTargetMinimum = singleRequest.targetAmountMinimum !== '0'; | ||
| const isPostQuote = Boolean(singleRequest.isPostQuote); | ||
| const isExactInputRequest = | ||
| Boolean(singleRequest.isMaxAmount) && | ||
| new BigNumber(singleRequest.sourceTokenAmount).gt(0); | ||
|
|
||
| return hasTargetMinimum || isPostQuote || isExactInputRequest; | ||
| }) |
There was a problem hiding this comment.
The fiat re-quote request could get dropped by this filter if targetAmountMinimum happened to be '0' - it's not a post-quote, so the second condition wouldn't save it. The isExactInputRequest check distinguishes real exact-input requests (positive source amount + max amount flag) from empty gas fee token requests (zero source amount), ensuring the fiat re-quote passes through.
FiatStrategy submit flow with order polling and relay execution
| /** Order identifier - `orderCode` specifically used as RampsService:getOrder parameter in normalized format (/providers/{provider}/orders/{id}). */ | ||
| orderCode?: string; |
There was a problem hiding this comment.
Minor, orderId or rampsId to be more generic?
|
|
||
| if (!original.gt(0) || !reQuoted.gt(0)) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Slippage check skips when re-quoted amount is zero
Medium Severity
validateRelaySlippage early-returns when either original or reQuoted is not positive. Skipping when the original is zero is correct (can't compute percentage slippage), but also skipping when the re-quoted amount is zero silently accepts a 100% loss scenario. The test only covers the "original is zero" case, confirming the developer's intent was narrower than what the || condition implements.
Reviewed by Cursor Bugbot for commit 5091f0a. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ 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 23e00be. Configure here.


Explanation
Implements
FiatStrategysubmit flow with order polling and relay execution.submitFiatQuotesto poll the on-ramp order viaRampsController:getOrderuntil completion, then re-quote and submit the relay leg with the settled crypto amountorderCodefield toTransactionFiatPaymentandRampsControllerGetOrderActiontoAllowedActionsto enable order polling from the fiat strategyReferences
Checklist
Note
Medium Risk
Adds a new fiat submission path that polls on-ramp orders and then re-quotes/submits Relay based on the settled amount; mistakes here can cause failed submissions or unexpected amounts. Also changes Relay quote filtering logic, which may affect which quote requests are processed.
Overview
Implements the
FiatStrategysubmit flow:submitFiatQuotesnow pollsRampsController:getOrderuntil completion (with timeout, terminal failure handling, and transient error tolerance), validates the completed order’s asset/chain, converts the settled crypto amount to raw units, re-quotes Relay with an exact-input max-amount request, checks re-quote slippage (5% cap), and submits viasubmitRelayQuotes.Updates
TransactionPayControllerso changes tofiatPaymenttrigger quote refreshes, and changing the fiat payment method attempts to syncRampsController:setSelectedToken(best-effort, errors swallowed). Extends types to includeTransactionFiatPayment.orderIdand addsRampsController:getOrder/RampsController:setSelectedTokentoAllowedActions, plus broad new test coverage for the fiat submit flow and token-selection behavior.Reviewed by Cursor Bugbot for commit 45c2c79. Bugbot is set up for automated code reviews on this repo. Configure here.