Rubicexchange

Rubicexchange API swaps when output amounts change

Rubicexchange recalculates destination output amounts when an application requests swap execution data. An integrator must compare that updated calculation with the earlier quote and obtain explicit approval for significant changes. Market movement, liquidity updates, and provider recalculation can alter the amount before funds move. Preparing a swap response doesn’t transfer assets. The application remains responsible for sending the transaction or deposit and checking its progress afterward.

Updated on
Key takeaway: Rubicexchange’s recommended ±0.5% band around quoted output guides confirmation of changed amounts, while each route retains its own execution conditions.

Quote amounts and executable swap data

The quote and swap responses describe the same proposed exchange at different moments, so their destination amounts can differ before the application submits a transaction. A quote evaluates available providers and estimates the output. Requesting execution data recalculates that output for the selected route.

The initial amount gives the user terms to consider. The later calculation tells the application what the prepared execution currently expects to deliver. Preserve the amount the user actually confirmed rather than overwriting it as soon as refreshed data arrives. Losing the earlier value removes the baseline needed to detect a change. The comparison must connect the confirmed quote with its selected swap, not with an unrelated request still awaiting a response.

Both on-chain and cross-chain integrations separate quoting from preparing execution data. Execution models differ in how an application sends the prepared exchange. That difference changes the submission instructions, while the amount check remains tied to the destination output the user accepted.

Market movement and provider recalculation

Output can change because token prices move, available liquidity changes, or a provider recalculates the exchange between quoting and preparing execution data. A difference between responses therefore doesn’t, by itself, establish an API failure. The integration needs to distinguish a successfully returned, changed calculation from a request error, since each calls for different handling.

Destination amounts and matching units

Compare quantities of the same destination token in the same units, preserving token identity and decimal precision alongside each response. The quote schema includes destinationTokenAmount and destinationWeiAmount . Compare the quote and swap values using matching representations. Comparing a token quantity with its base-unit representation would measure a unit mismatch rather than an economic change.

Big-number arithmetic can preserve the precision needed for the bounds comparison when quantities contain many base-unit digits or fractional token amounts. Formatting a quantity for display and comparing its underlying value are separate operations; a shortened display shouldn’t become the application’s comparison input.

Rubicexchange: Destination amounts and matching units - diagram

View image file

Rubicexchange recommends explicit confirmation for output changes outside a ±0.5% band around the quoted amount. For a change outside this band, pause execution and ask the user to accept the updated terms. The percentage concerns the destination output the user previously confirmed.

The quoted output supplies the denominator for measuring relative change. With a positive quoted output, calculate relative change as the updated output minus the quote, divided by the quote, and multiplied by 100%. A source-token amount doesn’t supply the same baseline. Use compatible destination quantities throughout the comparison.

Both directions matter under the recommended band. An increase beyond the upper boundary also prompts confirmation, even though it presents a larger expected output.

The API returns its latest calculation without explicitly identifying a significant deviation. The integrator must perform that check. Receiving a successful response therefore leaves a separate application decision: whether the updated amount requires renewed user approval.

At exactly either boundary, the amount remains inside the recommended band; the comparison flags values strictly outside it.

Explicit approval and the fresh swap request

A significant change requires a pause before submission, explicit acceptance of the new amount, and a new swap request after approval. The renewed request generates execution data for proceeding under refreshed terms. Compare the fresh output with the amount the user just approved before using its execution data. If the output deviates significantly again, pause for renewed approval and request fresh swap data before submission.

Visual summary: Explicit approval and the fresh swap request (Rubicexchange)
Illustration: Explicit approval and the fresh swap request.

View image file

A rejection ends the execution flow before submission. The application shouldn’t send transaction data or transfer a deposit from that rejected request.


Does a swap response confirm that destination tokens have arrived?

A swap response supplies the latest calculated output and the data needed for execution; it doesn’t establish destination receipt. The swap API returns execution instructions without automatically executing the transaction.

API response Contribution to the exchange What the response establishes
Quote Route information and expected destination output An indicative estimate that may change
Swap Recalculated output and execution data Prepared instructions requiring a transaction or deposit
Transaction status Progress and destination-completion information The reported execution state, including completion or failure
The amount in prepared swap data and the outcome reported after execution describe different stages.

For an application displaying a cross-chain exchange, the updated amount belongs with the terms awaiting execution. Later status information supports the completion message. Keeping those meanings separate prevents a refreshed output estimate from appearing as tokens already delivered. This applies even when the earlier quote and updated amount happen to match.


Slippage fields and the separate confirmation decision

Slippage information and minimum destination amounts describe route terms, while an amount-change check compares the output calculations returned at different API stages. The quote schema exposes these fields separately from expected destination output. Their presence doesn’t tell the application whether its chosen confirmation band has been exceeded. The recommended ±0.5% band isn’t a universal slippage setting for every provider or execution model. Keep route constraints and application approval policy distinct in the implementation. The quote schema also separates price impact from slippage; the integration should retain that distinction in its display.


Token allowance and wallet authorization

Token allowance governs an ERC-20 spender’s permission to use tokens on the specified blockchain, while amount confirmation records acceptance of updated destination output. The API provides allowance and approval utilities to support the first task. A wallet authorization or token approval doesn’t replace the application’s changed-amount prompt. Likewise, a sufficient existing allowance for the required spender can remove the need for another token approval without removing the need to compare quoted and recalculated output.

Execution instructions across contract and deposit models

Execution data follows the selected provider and blockchain combination, so the application must handle changed amounts without assuming every swap produces the same transaction format. Supported API models include EVM contract-based swaps, EVM deposit-based swaps, non-EVM native transactions, and manual deposit execution for non-EVM routes. Each model places different execution work on the integration. Compare amounts before the application submits the exchange.

Contract-based execution requires the application to send the returned transaction data through the relevant wallet integration. Deposit-based execution requires the corresponding transfer. The API can supply deposit information such as the address, amount to send, and exchange identifier. An updated destination-output estimate is a different quantity from the source amount a deposit instruction asks the sender to transfer. Preserve that distinction when presenting the changed terms.

The native non-EVM execution models include TON, TRON, Solana, and Sui. These supported models don’t establish that every token pair is available. Use the execution instructions associated with the selected route; changing the amount-confirmation interface doesn’t change the route’s compatibility requirements.

Status tracking after execution begins

Status tracking becomes relevant after the application initiates execution, and it serves a different purpose from comparing amounts before submission. Cross-chain status tracking can check whether the destination transaction has completed. The API also supports monitoring progress and handling partial execution or failures. Keep amount-change records separate from execution status so a changed quote doesn’t appear as an execution failure.

A cross-chain exchange can require follow-up beyond the source-chain transaction. A source submission alone doesn’t establish that the destination transaction completed. Preserve the provider and exchange context needed to interpret later status information. When execution remains incomplete, the interface should report that state rather than treating the earlier amount confirmation as proof of delivery.

SDK support and the application’s acceptance policy

The TypeScript SDK wraps the API’s quoting, swap-data, status, and utility functions, allowing integrations to use typed methods for the same underlying tasks. It also provides a status-polling helper. Detecting significant amount changes and obtaining explicit confirmation remain integration concerns, whether the application uses API responses directly or through the wrapper.

Keep the confirmed output available until the relevant execution decision has been resolved. Comparing refreshed output with that amount and requiring approval for significant changes prevents submission on unapproved terms.

Rubicexchange questions, answered

Can an inline warning replace a modal for confirming changed output?

An inline warning can obtain explicit confirmation of a significant output change. The confirmation can use a modal, an inline warning with accept and cancel controls, or a full-screen step. The interface format is flexible; acceptance of the updated amount must remain explicit.

What information belongs in an output-change confirmation message?

Show the previous quoted amount, the updated swap amount, the destination token symbol, and clear continue or cancel actions. These details identify the quantity being reconsidered. A generic notice that the rate changed leaves the user without the actual output terms needed to approve the exchange.

Where can an integration obtain identifiers for later cross-chain status checks?

The swap response supplies the trade identifier. For decentralized providers, status checks require that identifier and the hash of the submitted source transaction. Deposit-based providers require only the identifier. A returned identifier connects the status request to its exchange; possession of that identifier alone doesn’t establish destination completion.

Does rejecting revised output cancel a blockchain transaction already submitted?

Rejecting revised output stops the pre-submission execution flow described by the amount-change mechanism. That rejection doesn’t establish cancellation of an already submitted transaction or a refund. After submission, the application needs to interpret the transaction’s actual status and any provider-specific recovery process.

Is a destination-token dollar estimate sufficient for the amount-change comparison?

The comparison uses destination-token quantities from the quote and swap stages. Dollar estimates are separate values in the quote response and don’t replace that token-amount baseline. Keep the destination token and its units consistent when evaluating deviation, even if the interface also displays an estimated dollar value.

Must an integration confirm changed output when a non-EVM wallet only receives tokens?

The application still needs explicit confirmation of a significant output change. Receiver-only access can allow entry of a non-EVM destination address without a second wallet login. That access convenience doesn’t lock the quote or change the integration’s responsibility to compare updated output with the accepted amount.

How are refunds handled if a swap fails after updated output was accepted?

Refund handling depends on the selected provider. In most cases, the provider processes refunds automatically without client or user action. Rubicexchange’s API also provides a Celer Bridge refund-data utility for cases requiring refund execution on the source or destination network. Acceptance of updated output doesn’t establish that a refund has completed.