Endpoint list
Get plaftorms
GET
v1/platforms
Provides a list of supported blockchain networks.
Request sample:
https://api.yad.finance/v1/platforms
Get gas prices
GET
v1/{chainID}/gasprices
Provides calculated gas price values in GWEI (nAVAX for Avalanche).
Request sample:
https://api.yad.finance/v1/1/gasprices
Path Parameters
chainId*
Integer
The blockchain ID for which the gas price is requested.
Get on-chain price for pair
GET
v1/{chainID}/price
Returns the best route and exchange offer for pair, no calldata for transaction. Works faster than /quote
.
Request sample:
https://api.yetanotherdefi.com/v1/1/price?fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&amount=1500000000&slippage=1&gasPrice=16000000000&feeRecipient=0xdac17f958d2ee523a2206206994597c13d831ec7&buyTokenPercentageFee=1&sellTokenPercentageFee=1&rfqOnly=false&withGas=false
Path Parameters
chainID*
Integer
Blockchain ID. (Supported networks - /v1/platforms)
Query Parameters
fromTokenAddress*
String
Smart contract address of the sale token.
toTokenAddress*
String
Smart contract address of the purchase token.
amount*
Integer
The amount of sale tokens in decimals of the token (can be taken from the method /tokens
).
slippage*
Number
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%). Default value : 1
gasPrice
String
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
String
Wallet address for receiving fees. The commission is paid from the purchase token.
buyTokenPercentageFee
Integer
Percentage of commission from the amount of purchase tokens, is taken in favor of feeRecipient. (10 = 1%, maximum value is 500).
sellTokenPercentageFee
Integer
Percentage of commission from the amount of sale tokens, is taken in favor of feeRecipient. (10 = 1%, maximum value is 500).
rfqOnly
Boolean
If TRUE: use only RFQ providers for routing.
Default value : false
excludeAggregator
String
Exclude some aggregators from routing (add several parameters for multiple exclude)
includeAggregator
String
Include some aggregators from routing (add several parameters for multiple include). This parameter cannot be combined with excludedAggregators.
withGas
Boolean
If TRUE: choose a route based on gas.
Default value : false
Transaction allowance
GET
v1/{chainID}/transaction/allowance
Checks how many of the user's tokens the exchange smart contract has access to.
Request sample:
https://api.yad.finance/v1/1/transaction/allowance?tokenAddress=0xdAC17F958D2ee523a2206206994597C13D831ec7&walletAddress=0x58f58219e2d2598588c1b457bb6da65c34d99310
Path Parameters
chainID*
Integer
The ID of the blockchain the token is located on (supported networks - /v1/platforms
).
Query Parameters
tokenAddress*
String
Smart contract address of the token for which access is being checked.
walletAddress*
String
Wallet of the user for which access is being checked.
Transaction approve
GET
v1/{chainID}/transaction/approve
Generates transaction input parameters to provide access to the user's tokens for the exchange smart contract.
Request sample:
https://api.yad.finance/v1/1/transaction/approve?tokenAddress=0xdAC17F958D2ee523a2206206994597C13D831ec7&amount=100000000000&gasPrice=100000000000
Path Parameters
chainID*
Integer
ID of the blockchain the token is located on (supported networks - /v1/platforms
).
Query Parameters
tokenAddress*
String
Address of the smart contract of the token for which the access request is generated.
takerAddress
String
Address of user’s wallet which will provide approve. When provided the gas will be estimated exactly.
amount
integer
The amount of user tokens to which access is granted. By default - infinite number.
gasPrice
Integer
Cost of gas for an approve transaction. By default: medium
contractAddress
String
Contract that we want to give an approval. If not passed, then the default for chain is used.
Get on-chain quote for pair
GET
v1/{chainID}/quote
Returns the best exchange offer and input parameters for the transaction.
Request sample:
https://api.yetanotherdefi.com/v1/1/quote?fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&amount=1500000000&slippage=1&gasPrice=16000000000&feeRecipient=0xdac17f958d2ee523a2206206994597c13d831ec7&buyTokenPercentageFee=1&sellTokenPercentageFee=1&skipValidation=true&withGas=false
Path Parameters
chainID*
Integer
ID of the blockchain tokens must be exchanged on (supported networks - v1/platforms
).
Query Parameters
fromTokenAddress*
String
Smart contract address of the sale token.
toTokenAddress*
String
Smart contract address of the purchase token.
takerAddress
String
The address which will fill the quote. When provided the gas will be estimated and returned.
amount*
Integer
The amount of sale tokens in decimals of the token (can be taken from the method /tokens
).
slippage*
Integer
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
String
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
String
Wallet address for receiving fees. The commission is paid from the purchase token.
buyTokenPercentageFee
Integer
Percentage of commission from the amount of purchase tokens, is taken in favor of feeRecipient. (10 = 1%, maximum value is 500).
sellTokenPercentageFee
Integer
Percentage of commission from the amount of sell tokens, is taken in favor of feeRecipient. (10 = 1%, maximum value is 500).
recipientAddress
String
Wallet address for receiving purchase tokens. By default: sender address.
skipValidation
Boolean
If TRUE: skip calldata validation
Default value : true
excludeAggregator
String
Exclude some aggregators from routing (add several parameters for multiple exclude).
includeAggregator
String
Include some aggregators from routing (add several parameters for multiple include). This parameter cannot be combined with excludedAggregators.
withGas
Boolean
If TRUE: choose a quote based on gas.
Default value : false
List tokens
POST
v2/tokens/list
Get a list of tokens with filters and pagination.
Request sample
cURL:
curl -X 'POST' \
'https://api.yetanotherdefi.com/v2/tokens/list' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "filter": { "symbols": [ "ETH" ] }, "paging": { "page": 1, "page_size": 100 } }'
Request Body
filter
object
Filtering occurs with an 'AND' statement between fields and an 'OR' statement between array elements.
For example: chain_ids[1, 2], names[asd] == all tokens where chain_id is "1" or "2" and name equal "asd".
Searching by all text filters is case-insensitive.
addresses
string array
Token smart contract addresses.
chain_ids
integer array
Blockchain network IDs.
is_active
boolean
FALSE = the token is rarely used in exchanges on DEXs
If null - get only active.
names
string array
Full names of tokens.
symbols
string array
Abbreviated names of tokens.
paging
object
An object for adjusting response sizes.
page*
integer
Page number.
This parameter can be useful when the total sample size of tokens that meet the criteria from the filter exceeds the page size.
Can't be less than 1.
page_size
integer
Response size. For example, "page_size": 5 == get 5 tokens that meet the filtering conditions.
Max 100. If zero - unlitimited page size
Last updated