YAD docs
Launch App
  • Introduction
    • Key features
    • Use cases
  • Getting started
    • Wallet creation
    • How do I get crypto to start trading?
    • Wallet connection
    • Token approval
    • Making a swap
    • How to check your transaction in blockchain
  • Swap modes
    • One-Track Swaps
    • Chain-Hopping Swaps
    • Diamond Mode
  • Architecture
    • Smart contracts
    • Proxy addresses
    • Request for Quote (RFQ)
  • Integration Guides
    • One-Track Swaps API
      • Getting started
      • Use cases
      • Endpoint list
      • Swagger documentation
    • Cross-Chain Swaps API
      • Getting started
      • Use cases
      • Endpoint list
      • Swagger documentation
    • Widget
      • API key management
      • Integration flow
  • Security
    • Smart contract audit
  • Contact us
    • Further support
  • Knowledge base
    • Glossary
    • Basics
      • What is gas price?
      • What is price impact?
      • What is slippage?
      • What is the fee structure?
Powered by GitBook
On this page
  • Get plaftorms
  • Get gas prices
  • Get on-chain price for pair
  • Transaction allowance
  • Transaction approve
  • Get on-chain quote for pair
  • List tokens
  1. Integration Guides
  2. One-Track Swaps API

Endpoint list

Get plaftorms

GET v1/platforms

Provides a list of supported blockchain networks.

Request sample: https://api.yad.finance/v1/platforms

{
  "platforms": [
    {
      "chainId": 1,
      "name": "Ethereum",
      "shortname": "ETH"
    },
    {
      "chainId": 10,
      "name": "Optimistic Ethereum",
      "shortname": "Optimism"
    },
    {
      "chainId": 56,
      "name": "BNB Smart Chain",
      "shortname": "BSC"
    }
  ]
}
Name
Data Type
Description

platforms

array

An array of supported networks.

chainId

int

The blockchain network ID.

shortname

str

The short name of the blockchain network.

name

str

The full name of the blockchain network.

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

Name
Type
Description

chainId*

Integer

The blockchain ID for which the gas price is requested.

{
  "baseFee": "13.757",
  "low": "14.757",
  "lowInfo": {
    "price": "14.757",
    "maxPriorityFeePerGas": "0.5",
    "maxFeePerGas": "14.257"
  },
  "medium": "16.757",
  "mediumInfo": {
    "price": "16.757",
    "maxPriorityFeePerGas": "0.55",
    "maxFeePerGas": "15.683"
  },
  "high": "18.757",
  "highInfo": {
    "price": "18.757",
    "maxPriorityFeePerGas": "0.65",
    "maxFeePerGas": "18.535"
  }
}

Name
Data Type
Description

baseFee

str

Base fee for the next block in blockchain.

low

str

The gas price at which the transaction is most likely to be accepted not earlier than after block 5. There is a risk of a long transaction confirmation.

medium

str

The gas price at which the transaction is most likely to be accepted in the next 2-3 blocks.

high

str

The gas price at which the transaction is most likely to be accepted in the next block.

lowInfo (mediumInfo / highInfo)

map

Detailed gas price info for EIP-1559.

price

str

Gas price (for legacy transactions, not EIP-1559).

maxPriorityFeePerGas

str

Max Priority Fee Per Gas (tips in EIP-1559).

maxFeePerGas

str

Max Fee Per Gas (for EIP-1559).

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

Name
Type
Description

chainID*

Integer

Blockchain ID. (Supported networks - /v1/platforms)

Query Parameters

Name
Type
Description

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

{
  "amount_out_total": "1498367401285001674752",
  "estimate_gas_total": "595785",
  "token_in": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "token_out": "0x6b175474e89094c44da98b954eedeac495271d0f",
  "gas_price": "16000000000",
  "fee_recipient_amount": "1497002",
  "routes": [
    {
      "type": "dex",
      "protocol_name": "eth_odos",
      "percent": 100
    }
  ]
}

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.

token_in

str

Smart contract address of the sale token.

token_out

str

Smart contract address of the purchase token.

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.

routes

array

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

type

str

Liquidity source type.

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.

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

Name
Type
Description

chainID*

Integer

The ID of the blockchain the token is located on (supported networks - /v1/platforms).

Query Parameters

Name
Type
Description

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.

{
  "remaining": "11579208923731620000"
}
Name
Data Type
Description

remaining

str

The number of tokens in decimals of the token the smart contract has access to.

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

Name
Type
Description

chainID*

Integer

ID of the blockchain the token is located on (supported networks - /v1/platforms).

Query Parameters

Name
Type
Description

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.

{
  "calldata": "0x095ea7b30000000000000000000000001aaad07998466cd3eb8140827dddb37570be1e63000000000000000000000000000000000000000000000000000000174876e800",
  "gas_price": "100000000000",
  "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "estimate_gas": "48561"
}
Name
Data Type
Description

calldata

str

One of the input parameters for processing a transaction providing access to tokens.

gas_price

str

Gas price value for a transaction in WEI.

to

str

Address of the smart contract the transaction should be sent to.

estimate_gas

str

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

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

Name
Type
Description

chainID*

Integer

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

Query Parameters

Name
Type
Description

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

{
  "amount_out_total": "1498328896581420449792",
  "estimate_gas_total": "645770",
  "token_in": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "token_out": "0x6b175474e89094c44da98b954eedeac495271d0f",
  "gas_price": "16000000000",
  "fee_recipient_amount": "0",
  "routes": [
    {
      "type": "dex",
      "protocol_name": "eth_odos",
      "percent": 100
    }
  ],
  "calldata": "0x1342555a00000000000000000000000076f4eed9fe41262669d0250b2a97db79712ad85500000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000595157560000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000005124b26ec2d91fba5e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a4f17a454600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000001e42741ef6a26c2eb653000000000000000000000000000000000000000000001e3ab50761655600000000000000000000000000000000000bdc51918c9407d2a7a0f34b68f16c26ea13ac2c9000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000059515756000000000000000000000000bdc51918c9407d2a7a0f34b68f16c26ea13ac2c90000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000005f5eedb000000000000000000000000ca188796c709f3e052006a7e1e80b309ddd260ad0000000000000000000000000000000000000000000000000000000000000048010203000d0101010200ff00000000000000000000000000000000000000000048da0965ab2d2cbf1c17c09cfb5cbe67ad5b1406dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a97e0564F0AAC50000",
  "to": "0x1AAAd07998466cD3Eb8140827DDdb37570BE1e63",
  "expiry": 1693494007
}

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.

token_in

str

Smart contract address of the sale token.

token_out

str

Smart contract address of the purchase token.

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.

routes

array

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

type

str

Liquidity source type.

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.

expiry

int

Quote expiration time (in unix epoch time format). Applicable for RFQ providers only.

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

Name
Type
Description

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

{
  "tokens": [
    {
      "chainId": 1,
      "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "name": "Ethereum",
      "symbol": "ETH",
      "decimals": 18,
      "logoURI": "https://cl.yad.finance/static-files/1i/1/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/48x48.png",
      "is_active": true,
      "priority": 1,
      "is_rfq_mode": false
    },
    {
      "chainId": 10,
      "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "name": "Ethereum",
      "symbol": "ETH",
      "decimals": 18,
      "logoURI": "https://cl.yad.finance/static-files/1i/10/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/48x48.png",
      "is_active": true,
      "priority": 1,
      "is_rfq_mode": false
    }
  ]
}
Name
Data type
Description

tokens

array

An array of tokens.

chainId

int

The blockchain network ID.

address

str

The token smart contract address.

name

str

Full name of the token.

symbol

str

Abbreviated name of the token.

decimals

int

The number of decimals used to get its user representation. For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5.05 (505 / 10 ** 2).

logoURI

str

A link to the token logo.

is_active

boolean

FALSE = the token is rarely used in exchanges on DEXs.

priority

int

Recommended priority of a token to be shown to the user, based on the popularity of the token.

is_rfq_mode

boolean

TRUE = the token is supported by RFQ providers.

PreviousUse casesNextCross-Chain Swaps API

Last updated 1 year ago