GET /firm-quote
Obtaining Signed Order data for selling an ERC20 or Native Token and submitting to Native Router for swap execution.
This endpoint provides transaction data based on the requested token and token amount. For examples of using this endpoint, please refer to this section.
For native token swaps, Native uses 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
to represent the token address of the native token.
Headers
apiKey
API Key retrieved from the Native app
Params
src_chain
*
The blockchain name belonging to the token_in address - Refer to the GET /chains
API here for more information.
dst_chain
*
The blockchain name belonging to the token_out address - Refer to the GET /chains
API here for more information.
token_in
*
Address of the token to be sold
token_out
*
Address of the token to be bought
amount
Amount of token to be sold, in ether unit
amount_wei
Amount of token to be sold, in wei unit
from_address
*
Address of the user that sells the token_in
beneficiary_address
Address of the end user that initiated the swap request
to_address
Address of the user that receives the token_out
If empty, this address will be the same as from_address
expiry_time
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
Number in percentage value 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 transaction data for swapping 1 ETH to USDT on the Ethereum network.
Response
success
Indicates if the signing of the firm quote was successful
orders
Array of order objects. Refer to Params for more details.
widgetFee
Contains the widgetFee details. feeRecipient
is the address that will receive the widget fee and feeRate
is the amount of fees that the fee recipient will receive.
widgetFeeSignature
The signature of the transaction request and the widget fee
recipient
The address of the seller/swapper
calldata
The byte encoding for the orders
object
amountIn
The amount of sellerToken in wei, that will be sold to the buyer
amountOut
The amount of buyerToken in wei, that the buyer will be receiving
toWrap
Indicates if the order needs to be wrapped
toUnwrap
Indicates if the order needs to be unwrapped
fallbackSwapDataArray
This is the raw input data that will be executed by Native fallback
source
Indicates the liquidity provider that is providing this firm-quote
txRequest
The transaction request to be executed by the NativeRouter. The calldata
contains the raw input data that will be executed by the NativeRouter. The target
here is the address of the NativeRouter.
Example
In the response above, Native returns 1,864.151208 USDT for the order submitted.
Note: To send the transaction on-chain, you can utilize the txRequest
response. This response will be identical to the one provided by the GET /calldata
API endpoint.
Explore this endpoint and see how it works here.
Last updated