GET v1/firm-quote
Get signed calldata for selling a ERC20 / native token. Submit the return data to Native router to execute swap.
GET https://newapi.native.org/v1/firm-quote
This endpoint provides transaction data given the requested token and token amount. Please refer to execute swap section for examples of using the endpoint.
Native supports native token swap. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE to represent the token address of the native token.
Headers
apiKey
Contact Native to get your API key.
Params
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.
Example
https://newapi.native.org/v1/firm-quote?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
{
amountIn: "1000000000000000000",
amountOut: "1840718400",
calldata: "0x000000000000000000000000000000000000000000000000001c982ba9a441c72008b6c3d07b061a84f790c035c2f6dc11a0be703d130bf4686b3d4b6eb91a8e26ac629c5bea608242d4e9ee3f725c84b7934e4fda64f2be0f803130dac17f958d2ee523a2206206994597c13d831ec7c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000118e033000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000064db2c8042d4e9ee3f725c84b7934e4fda64f2be0f803130e4623ae93c5641a198c7c49bb20b31db8de7cee21e8dfc4a18a28cc4487b30928681d6b6228a646bac0bf7a32b0e9230226143d60dcf6f2bebadd8e5a500ac355b30beacea698d8fd20a5aaa84e6c9eb1c"
fallbackSwapDataArray: [],
orders: [{id: 8566093, signer: "0x2008b6c3D07B061A84F790C035c2f6dC11A0be70",…}],
recipient: "0x42d4e9ee3f725c84b7934e4fda64f2be0f803130",
success: true,
toUnwrap: false,
toWrap: false
widgetFee: {
feeRate: 0,
feeRecipient: "0x2397D2fdE31C5704b02AC1ec9B770f23D70d8EC4",
signer: "0x67297ee4eb097e072b4ab6f1620268061ae80464",
}
widgetFeeSignature: "0xc1a146cb77fa8ff22c4cf98766ae66299bc0ac927abfab69c83832a8c5f3331214a04630ba2aa8bb490136fcfdca7a5030fe75e8a45b917eecec57be48717cda1b"
}
In the response above, Native returns 1,839.7184 USDT for the order sent in the example.
Last updated