GET /v1/{chainID}/quote

Returns the best exchange offer and input parameters for the transaction

Input Parameters

Name
Required
Description

chainID

+

ID of the blockchain tokens must be exchanged on (supported networks - v1/platforms).

fromTokenAddress

+

Smart contract address of the sale token.

toTokenAddress

+

Smart contract address of the purchase token.

takerAddress

-

The address which will fill the quote. When provided the gas will be estimated and returned.

amount

+

The amount of sale tokens in decimals of the token (can be taken from the method /tokens).

slippage

+

The amount of slippage allowed during the actual execution of the transaction (10 = 1% slippage). If the price changes by more than this percentage, the transaction will revert. Min = 1 (0.1%), max = 500 (50%).

gasPrice

-

Gas price value for making a transaction in WEI (nAVAX for Avalanche) (1 GWEI = 1000000000 WEI), default value is the value high from /gasprices.

feeRecipient

-

Wallet address for receiving fees. The commission is paid from the purchase token.

buyTokenPercentageFee

-

Percentage of commission from the amount of purchase tokens, is taken in favor of feeRecipient. (10 = 1%, maximum value is 500).

Response Options

Name
Data type
Description

amount_out_total

str

The amount of purchase tokens in decimals of the token.

estimate_gas_total

str

The estimated amount of gas that will be used during the transaction.

gas_price

str

Gas price value for a transaction in WEI (nAVAX for Avalanche).

fee_recipient_amount

str

The amount of purchase tokens in decimals of the token, which will be taken in favor of feeRecipient. The value will be 0 if feeRecipient and buyTokenPercentageFee fields are not specified.

token_in

str

Smart contract address of the sale token.

token_out

str

Smart contract address of the purchase token.

routes

array

An array of DEXs the transaction will be carried out through.

protocol_name

str

DEX name the transaction will be carried out through.

percent

int

The percent of amount will be swapped on the current DEX.

calldata

str

One of the input parameters for processing a transaction for tokens exchange.

to

str

Smart contract address where input parameters should be sent to.

Request Example

https://api.yad.finance/v1/1/quote?fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&amount=1500000000&slippage=1&gasPrice=16000000000&feeRecipient=0xdac17f958d2ee523a2206206994597c13d831ec7&buyTokenPercentageFee=1

Response Example

{
  "amount_out_total": "1498829767947395025220",
  "estimate_gas_total": "265000",
  "token_in": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "token_out": "0x6b175474e89094c44da98b954eedeac495271d0f",
  "gas_price": "16000000000",
  "fee_recipient_amount": "1497329440850006780",
  "routes": [
    {
      "protocol_name": "DODO_V2",
      "percent": 100,
      "pools": null
    }
  ],
  "calldata": "0x415565b0000000000000000000000000dac17f958d2ee523a2206206994597c13d.....00000d8b5e9d2b6359a3071e41296359A307",
  "to": "0x1AAAd07998466cD3Eb8140827DDdb37570BE1e63"
}

Last updated

#88:

Change request updated