Native Tokens Support
Native Swap API and Router support swapping with native tokens for any trading pair involve wrapped-native token address (WETH9). For example, if you see WETH->USDT in /orderbook , you may quote and swap ETH->USDT directly.
Quote
For /indicative-quote and /firm-quote , use either:
0 address
0x0000000000000000000000000000000000000000E address
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
to represent the native tokens.
Pricing will follow the wrapped-native token trading pair.
By default, native token trading pairs will NOT appear in /orderbook return. If you wish to include them, refer to the following section.
Orderbook
If you wish to receive native token trading pairs in orderbook endpoint, please add one of the following parameters in the request:
showNative=0xEfor0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEshowNawtive=0x0for0x0000000000000000000000000000000000000000
Native token trading pairs will be appended to orderbook represented by the address you prefer.
Onchain Execution
Please remember to submit payable value according to the /firm-quote return. The payable value is indicated under txRequest.value.
Example:
## Get Firm Quote for BNB->USDT
curl "https://v2.api.native.org/swap-api-v2/v1/firm-quote?from_address=0xbf381E1cBfdb0D02F3800010e490130D3dC73118&amount=1&token_in=0x0000000000000000000000000000000000000000&token_out=0x55d398326f99059ff775485246999027b3197955&version=3&src_chain=bsc&dst_chain=bsc" \
-H "apiKey: $YOUR_KEY_HERE"{
"success": true,
// ...
"txRequest": {
"target": "0x0f9f2366C6157F2aCD3C2bFA45Cd9031c152D2Cf",
"calldata": "0x0947c2d90000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009af2f3c0cd35283e13f7087e2b34b1444b57a44c000000000000000000000000129b3d9a0a6e4beab88f5cb1e57995d72a6e24f1000000000000000000000000bf381e1cbfdb0d02f3800010e490130d3dc73118000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003ec88e2f7f54289b8000000000000000000000000000000000000000000000003ec88e2f7f54289b800000000000000000000000000000000000000000000000000000000068e291ab000000000000000000000000000000000000000000000000259ddd003a139df80000000000000000000000000000000000000000000000000000000068e291530000000000000000000000000000000000000000000000000000000068e2917100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000dd03b615428c48978cd530d675f63a0900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000006044eef7179034319e2c8636ea885b37cbfa9aba000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000041bdd47f0b484e75590ad60e37df0d43ef592ca00d6bca48231e1994dd3cfb449f27340cff07c4a773cfce71c977bf347d190d35731dfe3dce6b2213d121ef71f01b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000416ffbdf41167d1ebbbaf99a9a685f73c76a767b041362f73544498192fee515e6564bfcfc4fe448fd5865ba6ea5035077ed3c987743becc3768410957b0ceb5a11c00000000000000000000000000000000000000000000000000000000000000",
"value": "1000000000000000000"
},
// ...
}Tx: https://www.tdly.co/shared/simulation/b25777d2-001f-4f88-a88f-ca5d0978fa9f
Last updated