GET /calldata

Similar to /firm-quote, but the response is raw calldata that can be directly submitted on-chain.

bGET https://newapi.native.org/v1/firm-quote/calldata

Header and Params are exactly the same as /firm-quote.

Headers

Params

Example

https://newapi.native.org/v1/firm-quote/calldata?chain=ethereum&token_in=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&token_out=0xdAC17F958D2ee523a2206206994597C13D831ec7&amount=1&from_address=0x42d4e9ee3f725c84b7934e4fda64f2be0f803130&deadline_timestamp=1692085583

In this example, the wallet 0x42d4e9ee3f725c84b7934e4fda64f2be0f803130 requests transaction data for swapping 1 ETH to USDT on the Ethereum network.

Response

Example

{
    "from": "0x42d4e9ee3f725c84b7934e4fda64f2be0f803130",
    "to": "0xEAd050515E10fDB3540ccD6f8236C46790508A76",
    "calldata": "0xc7cd97480000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012000000000000000000000000042d4e9ee3f725c84b7934e4fda64f2be0f8031300000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000006d0060b000000000000000000000000067297ee4eb097e072b4ab6f1620268061ae804640000000000000000000000002397d2fde31c5704b02ac1ec9b770f23d70d8ec4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000149000000000000000000000000000000000000000000000000000c94c046e2059d2008b6c3d07b061a84f790c035c2f6dc11a0be703d130bf4686b3d4b6eb91a8e26ac629c5bea608242d4e9ee3f725c84b7934e4fda64f2be0f803130dac17f958d2ee523a2206206994597c13d831ec7c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000006e1a3d770000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000653a214342d4e9ee3f725c84b7934e4fda64f2be0f8031309b7994d5ee304111ba952c1ceb20b03928017af9661bfc8653fbd7d27c26c7db5f43ccf2927ae147e41f9e18e9a0b0f81e766bc67dfbcca6e954c10d7e93ddd24f94c1ce8db4ee49d96c11c84a153f801b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041360a02816ec26c8cfb04d0f0ad10c480f184332c62d9e56c6180ab4d1992166e79d4a135dff39bc8f8159d14b5e3c57e6e4d030a27ca6590f05739c8c66cc2ef1b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "value": "1000000000000000000", // Amount of native token, will be 0 for non-native tokens
    "amountOut": "2375239915",
    "amountInOffset": 100, // <OPTIONAL> Will be undefined if the target liquidity pool is not a native pool (non-PMM pool).
    "amountOutMinimumOffset": 132 // <OPTIONAL> Will be undefined if the target liquidity pool is not a native pool (non-PMM pool).
}
  • from, to, calldata: The calldata can be sent from the from address to the to address to execute the swap. Ensure that the from address has sufficient allowance set for the NativeRouter (which is the to address).

  • amountInOffset: This indicates the offset position (in bytes) of the amountIn parameter. For example, in the sample response above, the amountIn (uint256) occupies bytes 100-131. This is useful if you want to adjust the amountIn within the calldata.

  • amountOutMinimumOffset: This indicates the offset position (in bytes) of the amountOutMinimum parameter. For example, in the sample response above, the amountOutMinimum (uint256) occupies bytes 132-163. This is useful if you want to adjust the amountOutMinimum (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