GET /calldata
Similar to /firm-quote, but the response is raw calldata that can be directly submitted on-chain.
Header and Params are exactly the same as /firm-quote
.
Headers
apiKey
API Key retrieved from the Native app
Params
chain
*
token_in
*
Token address for the token to be sold
token_out
*
Token address for the token to be bought
amount
(optional)
Amount of token to be sold, in ether unit
amount_wei
(optional)
amount of token to be sold, in wei unit
from_address
*
Address of the user that sells the token_in
beneficiary_address
Address of the end user that initiated the swap request
to_address
Address of the user that receives the token_out
If empty, this address will be the same as from_address
expiry_time
(optional)
Expiry time in seconds This variable will be passed on to the market makers to consider when they give the quote. Market makers would be able to give better quote for a shorter expiry time. It will affect the
deadlineTimestamp in the response if the quote from that market maker is chosen. If not provided, we will just use the default expiry time by the liquidity source.
slippage
(optional)
Number in percentage value
For example, passing the value 5 means 5%, 0.1 means 0.1% slippage tolerance. By default it's 0.
Example
In this example, the wallet 0x42d4e9ee3f725c84b7934e4fda64f2be0f803130
requests transaction data for swapping 1 ETH to USDT on the Ethereum network.
Response
from
The address that will send the calldata to the NativeRouter
to
The address of the NativeRouter
calldata
The raw input data that will be executed by the NativeRouter
value
The msg.value for the transaction. Will be 0 if the seller token is a non-native token.
amountOut
Amount of token to be sold, in wei unit
amountInOffset
(optional)
The offset position (in bytes) of the param amountIn
. You can modify this value freely. Will be undefined if the target liquidity pool is not a native pool (non-PMM pool).
amountOutMinimumOffset
(optional)
The offset position (in bytes) of the param amountOutMinimum
. You can modify this value to protect yourself from slippage accordingly. Will be undefined if the target liquidity pool is not a native pool (non-PMM pool).
Example
from
,to
,calldata
: Thecalldata
can be sent from thefrom
address to theto
address to execute the swap. Ensure that thefrom
address has sufficient allowance set for the NativeRouter (which is theto
address).amountInOffset
: This indicates the offset position (in bytes) of theamountIn
parameter. For example, in the sample response above, theamountIn
(uint256) occupies bytes 100-131. This is useful if you want to adjust theamountIn
within the calldata.amountOutMinimumOffset
: This indicates the offset position (in bytes) of theamountOutMinimum
parameter. For example, in the sample response above, theamountOutMinimum
(uint256) occupies bytes 132-163. This is useful if you want to adjust theamountOutMinimum
(for slippage protection) within the calldata.
If you prefer to use only Native pools (PMM-only pricing), please contact the Native team to have this option configured for you.
Explore this endpoint and see how it works here.
Last updated