⚙️
Native Developers
  • Native V1
    • Overview
    • Operations
      • Single-Hop Transaction: Off-chain Pricing
      • Single-Hop Transaction: On-chain Pricing
      • Multi-Hop Transaction
      • L1 Token Swap
      • Creating a Pool
      • Updating a Pool
    • System Components
      • GUI
      • Native Backend
      • Pricer
      • Registry
      • Signer
      • Pool
      • Pool Factory
      • Treasury
      • Router
    • Smart Contracts
      • Core
        • Registry
        • NativePool
        • NativePoolFactory
        • NativeRouter
      • Liquidity Pools
    • Contract Address
    • API References
      • GET /v1/indicative-quote
      • GET /v1/orderbook
      • GET v1/firm-quote
      • GET v1/firm-quote/calldata
    • Guide
      • Get quote for ETH to USDT
      • Execute ETH to USDT swap on Native
    • Routing
  • Market Maker Integration
    • WebSocket Connection
Powered by GitBook
On this page
  1. Native V1
  2. API References

GET v1/firm-quote/calldata

Very similar to `/firm-quote`. Just that response is raw calldata that can be submitted on-chain directly

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

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

Headers

Name
Description

apiKey

Contact Native to get your API key.

Params

Name
Description

chain

Blockchain name. Supported chains: ethereum, bsc

token_in

Token address for the token to be sold.

token_out

Token address for the token to be bought.

amount

Amount of token to be sold, in ether unit.

address

Address of the user making the swap.

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

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

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

Response

{
    "from": "0x42d4e9ee3f725c84b7934e4fda64f2be0f803130",
    "to": "0xEAd050515E10fDB3540ccD6f8236C46790508A76",
    "calldata": "0xc7cd97480000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000012000000000000000000000000042d4e9ee3f725c84b7934e4fda64f2be0f8031300000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000060f571f600000000000000000000000067297ee4eb097e072b4ab6f1620268061ae804640000000000000000000000002397d2fde31c5704b02ac1ec9b770f23d70d8ec4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000001490000000000000000000000000000000000000000000000000002c3e5287ca5df2008b6c3d07b061a84f790c035c2f6dc11a0be703d130bf4686b3d4b6eb91a8e26ac629c5bea608242d4e9ee3f725c84b7934e4fda64f2be0f803130dac17f958d2ee523a2206206994597c13d831ec7c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000060f571f60000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000006504127342d4e9ee3f725c84b7934e4fda64f2be0f803130d8211c67f8f64485994dd088c2551bc089756b5d50abb3fd43f808a34bd5c6e16a5187c8c457c7eb226f7fc3c5482169786fdf8dd079d4d95a2253fe7d6bd50cbadb53dd54fcf6006dfafdd7d987d1c81b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041222ea97d1eb5955f8fd5e23c736f3f310891e75313af33751a6c18198a1db08f3e7c0c467b393f627453d7ece80c918395d7bf38287217d08d542a87e179190b1c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "amountInOffset": 100,
    "amountOutMinimumOffset": 132
}
  • from, to, calldata: The calldata could be sent to the to address from the from address to execute the swap. from address should have enough allowance to NativeRouter (which is the to address)

  • amountInOffset: The offset position (in bytes) of the param amountIn. For example in the sample response above the amountIn (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 param amountOutMinimum. For example in the sample response above the amountIn (uint256) is taking the bytes in 132-163. Useful when the user wants to adjust the amount out minimum (for slippage protection) in calldata.

PreviousGET v1/firm-quoteNextGuide

Last updated 1 year ago