GET /calldata
Similar to `/firm-quote`. Just that response is raw calldata that can be submitted on-chain directly
Header and params are exactly the same as /firm-quote.
Headers
Name | Description |
---|---|
apiKey | API Key retrieved from the Native app. |
Params
Name | Description |
---|---|
chain* | Blockchain name, you can refer to supported chain API. |
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 |
beneficiary_address | Address of the end user that initiated the swap request. |
to_address | Address of the user that receives the |
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 percent. For example, passing the value 5 means 5%, 0.1 means 0.1% slippage tolerance. By default it's 0. |
Example
In this example, wallet 0x42d4e9ee3f725c84b7934e4fda64f2be0f803130 requests for transaction data for swapping 1 ETH to USDT on Ethereum.
Response
Name | Description |
---|---|
from | The address that will send the calldata to the Native router. |
to | The address of the Native router. |
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 |
amountOutMinimumOffset (optional) | The offset position (in bytes) of the param |
Example response:
from
,to
,calldata
: Thecalldata
could be sent to theto
address from thefrom
address to execute the swap.from
address should have enough allowance to NativeRouter (which is theto
address)amountInOffset
: The offset position (in bytes) of the paramamountIn
. For example in the sample response above theamountIn
(uint256
) is taking the bytes in 100-131. Useful when the user wants to adjust the amount in in calldata.amountOutMinimumOffset
: The offset position (in bytes) of the paramamountOutMinimum
. For example in the sample response above theamountIn
(uint256
) is taking the bytes in 132-163. Useful when the user wants to adjust the amount out minimum (for slippage protection) in calldata.
If you only want to use native pools (PMM only pricing), you can reach out to the native team and we will configure this option for you.
You may try this endpoint out here.
Last updated