Request a swap quote
Generates a swap quote based on input parameters such as the assets, amount, slippage tolerance, and recipient/refund information.
Returns pricing details, estimated time, and a unique deposit address to which tokens must be transferred to initiate the swap.
You can set the dry parameter to true to simulate the quote request without generating a deposit address or initiating the swap process. This is useful for previewing swap parameters or validating input data without committing to an actual swap.
This endpoint is the first required step in the swap process.
Body
How to interpret amount (and refunds) when performing the swap:
-
EXACT_INPUT— requests the output amount for an exact input.- If deposit is less than
amountIn, the deposit is refunded by deadline. - If deposit is above than
amountIn, the swap is processed and the excess is refunded torefundToaddress after swap is complete.
- If deposit is less than
-
EXACT_OUTPUT— requests the input amount for an exact output.- The output amount (
amountOut) is fixed; slippage is applied to the input side. - The quote response includes
amountIn(the proposed input with slippage tolerance baked in) andminAmountIn(the minimum input required). - Important:
amountInwill appear higher thanminAmountInby approximately yourslippageTolerance. This is not price degradation—it is a buffer to ensure successful execution. Any input amount above what is actually needed for the swap is refunded to yourrefundToaddress after the swap completes. - If the deposit is above
amountIn, the swap is processed and the excess is refunded torefundToaddress after swap is complete. - If the deposit is less than
minAmountIn, the deposit is refunded by deadline.
- The output amount (
-
FLEX_INPUT— a flexible input amount that allows for partial deposits and variable amounts.slippageapplies both toamountOutandamountInand defines an acceptable range (minAmountInandminAmountOut).- Any amount higher than
minAmountInis accepted and converted to the output asset as long asminAmountOutis met. - The deposit must be at least
minAmountIn, after applying the slippage constraint to the quoted amount. Deposits belowminAmountInare refunded if the total received by the deadline is below this amount. - If deposits exceed the upper bound, the swap is still processed
-
ANY_INPUT— collects deposits and converts them to a destination asset. Used for fee aggregation and similar use cases. Only available for authorized partners.
EXACT_INPUT, EXACT_OUTPUT, FLEX_INPUT, ANY_INPUT Type of deposit address:
ORIGIN_CHAIN- deposit address on the origin chain.INTENTS- the account ID within NEAR Intents to which you should transfer assets.CONFIDENTIAL_INTENTS- the account ID within Confidential Intents to which assets are to be transferred. Fund the swap from a Confidential Intents account by submitting a signed transfer intent to the quotedepositAddress. Direct token transfers are not supported.
ORIGIN_CHAIN, INTENTS, CONFIDENTIAL_INTENTS Amount to swap as the base amount. It is interpreted as the input or output amount based on the swapType flag and is specified in the smallest unit of the currency (e.g., wei for ETH). Must be an integer string; decimal values like "0.01" are invalid—use base units (e.g. "10000000000000000" for 0.01 with 18 decimals).
"1000"
Type of refund address:
ORIGIN_CHAIN- assets are refunded to therefundToaddress on the origin chain.INTENTS- assets are refunded to therefundToIntents account.CONFIDENTIAL_INTENTS- assets are refunded to therefundToConfidential Intents account. On Confidential Intents, 1Click settles refunds via signed transfer intent rather than direct token transfer.
ORIGIN_CHAIN, INTENTS, CONFIDENTIAL_INTENTS Type of recipient address:
DESTINATION_CHAIN- assets are transferred to the chain ofdestinationAsset.INTENTS- assets are transferred to an account inside Intents.CONFIDENTIAL_INTENTS- assets are transferred to therecipientaccount inside Confidential Intents. On Confidential Intents, 1Click settles swap output via signed transfer intent rather than direct token transfer.
DESTINATION_CHAIN, INTENTS, CONFIDENTIAL_INTENTS Timestamp in ISO format that identifies when the user refund begins if the swap isn't completed by then. It must exceed the time required for the deposit transaction to be mined. For example, Bitcoin may require around one hour depending on the fees paid.
"2019-08-24T14:15:22Z"
What deposit address mode you will get in the response, most chain supports only SIMPLE and some(for example stellar) only MEMO:
SIMPLE- usual deposit with only deposit address.MEMO- some chains will REQUIRE thememotogether withdepositAddressfor swap to work.
depositMode applies only to deposit transaction metadata.
SIMPLE, MEMO "SIMPLE"
HIGHLY EXPERIMENTAL Message to pass to ft_transfer_call when withdrawing assets to NEAR.
Otherwise, ft_transfer will be used.
WARNING: Funds will be lost if used with non NEP-141 tokens, in case of insufficient storage_deposit or if the recipient does not implement ft_on_transfer method.
"smart-contract-recipient.near"