GET /v1/{chainID}/price
Returns best exchange offer, no calldata for transaction
Input Parameters
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.
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
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.
Request Example
https://api.yad.finance/v1/1/price?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
}
]
}
Last updated