Skip to main content
Helpful?

Introduction With example

AzurSwap API

AzurSwap API is a web3-based service related to blockchain and will be continuously updated. At the beginning of the service, this service and several of its methods will be available to the public for free, after the passage of time it may become items that must be purchased.

Introduction


First, by using the following request, we ensure connection to the API service:

https://api.azurswap.org/api

result:

Welcome To AzurSwap API.v1

Then, by using the /network request, you can view the list of available networks (at This time):

/api/networks

result:

[
"ETH",
"BNBTESTNET",
"BNB",
"RINKEBY",
"ARBITRUM_RINKEBY",
"ARBITRUM",
"AVALANCHE_FUJI_TESTNET",
"AVALANCHE_CMAINNET",
"FANTOM_TESTNET",
"FANTOM",
"GOERLI",
"ROPSTEN",
"KOVAN",
"OPTIMISM_GOERLI",
"OPTIMISM",
"POLYGON",
"POLYGON_MUMBAI",
"HARMONY",
"HARMONY_TESTNET",
"HECO",
"HECO_TESTNET",
"ETHClassic",
"Celo",
"Celo_Testnet"
]

Please note that these networks have been updated, and if they are updated, they may be slightly different from the document.


Get Details

In the next step, we can reach the address of the pool and their information through the contract address of 2 tokens.

Please be careful that instead of the coins of each network, you must use its wrap. Contact Azur Support if in doubt.

Next, we will replace the desired network that we have in mind using the previous step with :network . Then, we set the state to details.

/api/:network/state=details

for example:

/api/BNB/state=details?

Then we place the important parameters The parameters are:

firstToken = (address)
secToken = (address)

So, We have an example:

/api/BNB/state=details?firstToken=0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c&secToken=0x55d398326f99059fF775485246999027B3197955

result:

[
{
"NETWORK": "BNB",
"state": true,
"kLast": "683830384144425828579027661312505160",
"pairAddress": "0x8B405aAD6C90676ebbD68F2f38b1d7E17E8A7628",
"token0": {
"name": "Tether USD",
"symbol": "USDT",
"decimals": "18",
"totalSupply": "3179997922169098408283524569",
"totalSupply/Decimals": "3179997922.169",
"ContractAddress": "0x55d398326f99059fF775485246999027B3197955"
},
"token1": {
"name": "Wrapped BNB",
"symbol": "WBNB",
"decimals": "18",
"totalSupply": "3843793495725661208155228",
"totalSupply/Decimals": "3843793.496",
"ContractAddress": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
}
}
]

As can be seen, it will show us important information about the tokens as well as the address of the pool.

Please note that the pool must exist on AzurSwap.


Get Price tokens from LP-token

In this request, we can view the token price selectively using only the pool address. Please be careful that the calculated price may be slightly different from the price applied on the site, which is caused by mathematical calculations and also the difference in the swap price.

we will replace the desired network that we have in mind using the previous step with :network, for example BNB,ETH,etc.

After that, we change the state to price0 and price1. If price0 is selected, the price of the first token and if price1 is selected, the price of the second token will be selected according to the opposite token in the decentralized pool.

/api/:network/state=price1
// or
/api/:network/state=price0

then, Set parameters:

lpToken = (address)
amount = (uint)

for example :

/api/BNB/state=price1?lpToken=0x208D0910C2AFBF0028CbCeD541761dD073f83669&amount=100

result:

[
{
"NETWORK": "BNB",
"state": true,
"name": "BUSD Token",
"symbol": "BUSD",
"decimals": "18",
"totalSupply": "2850999086574384021862636159",
"Value": "100 USDT"
}
]

And other side, Use price0 instead of price1:

/api/BNB/state=price0?lpToken=0x208D0910C2AFBF0028CbCeD541761dD073f83669&amount=100

result:

[
{
"NETWORK": "BNB",
"state": true,
"name": "Tether USD",
"symbol": "USDT",
"decimals": "18",
"totalSupply": "3179997922169098408283524569",
"Value": "100 BUSD"
}
]

You can easily calculate the price of different tokens using the address of pools (LP) and use it in different platforms and systems. This pricing is reciprocal and you should manage it according to your request in currency pairs.

It is also possible to calculate pools outside of AzurSwap, but initially it will not be offered for free.


Get Price token from LP

One of the AzurSwap API methods is requesting token price using the token address and its pool address. In this method, we first specify the token and pool addresses, and then the desired amount to determine the price.

The request will be as follows:

/api/:network/state=price

Set the state to price and set other parameters:

Token = (address)
lpToken = (address)

Token The desired token address and lpToken address of the desired liquid pool are selected.

/api/:network/state=price?Token=address&lpToken=address&amount=uint

Then we put the desired value in amount, for example:

/api/BNB/state=price?Token=0x55d398326f99059fF775485246999027B3197955&lpToken=0x208D0910C2AFBF0028CbCeD541761dD073f83669&amount=100

result:

[
{
"NETWORK": "BNB",
"state": true,
"name": "Tether USD",
"symbol": "USDT",
"decimals": "18",
"totalSupply": "3179997922169098408283524569",
"Value": "100 BUSD"
}
]

AzurSwap API: The smart choice for developers. Our API is fast, reliable, and secure, giving you the tools you need to build cutting-edge DeFi applications. Join the AzurSwap community today.

Good luck.

Helpful?