Uniswap V2

/getprice

Returns the swap quotation for the given token pair.

GET https://api.expand.network/dex/getprice

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

dexId

String

Refer to the DEX ID page for details.

path*

String

Comma separated values of token addresses whose price is to be fetched.

amountIn*

String

Amount of token.

https://api.expand.network/dex/getprice?dexId=1000&path=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xdac17f958d2ee523a2206206994597c13d831ec7&amountIn=10000000000000000000

/getuserliquidity

Returns the balance of a particular token pair of an account.

GET https://api.expand.network/dex/getuserliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

tokenA*

String

Address of token.

address*

String

Public address of liquidity provider.

dexId

String

Refer to DEX ID page for details.

tokenB*

String

Address of token.

https://api.expand.network/dex/getuserliquidity?tokenA=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&tokenB=0x6b175474e89094c44da98b954eedeac495271d0f&address=0x6fb447ae94f5180254d436a693907a1f57696900&dexId=1000

/getpoolliquidity

Returns the total liquidity for a specified pool.

GET https://api.expand.network/dex/getpoolliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

Pool address whose liquidity is to be fetched.

dexId

String

Refer to DEX ID page for details.

https://api.expand.network/dex/getpoolliquidity?poolAddress=0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852&dexId=1000

/gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

GET https://api.expand.network/dex/gettokenliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId

String

Refer to DEX ID page for details.

https://api.expand.network/dex/gettokenliquidity?poolAddress=0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852&dexId=1000

/getliquidityholders

Returns the total number of liquidity holders in the specified pool.

GET https://api.expand.network/dex/getliquidityholders

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId

String

Refer to DEX ID page for details.

https://api.expand.network/dex/getliquidityholders?poolAddress=0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852&dexId=1000

/getindividualposition

Returns the liquidity position for a specified user address across all the pools for the DEX.

GET https://api.expand.network/dex/getindividualposition

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

address*

String

The public address of the liquidity holder.

dexId

String

Refer to DEX ID page for details.

poolAddresses

String

The pool Addresses whose liquidity is to be fetched. (Comma-separated vaules)

poolSize

String

The number of pools for which the user intends to fetch the individual position. By default: 50, Maximum: 9,950

https://api.expand.network/dex/getindividualposition?dexId=1000&address=0x6Fb447Ae94F5180254D436A693907a1f57696900

/getpoolindividualliquidity

Returns all user addresses, block numbers, and token position details for a specified pool address.

GET https://historicallp.api.expand.network/dex/getpoolindividualliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId

String

Refer to DEX ID page for details.

endPage

String

Index of the last page that user wants to query.

By default: startPage+9

startPage

String

Index of the start page that user wants to query.

By default: endPage-9

https://historicallp.api.expand.network/dex/getpoolindividualliquidity?startPage=211&endPage=212&poolAddress=0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852&dexId=1000

/gethistoricaltimeseries

Get the historical time series transactions for a specific pool address.

GET https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

endBlock

String

Last block of the range.

startBlock

String

Starting block of the range.

poolAddress*

String

Pool address whose time series is to be fetched.

https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries?poolAddress=0x517f9dd285e75b599234f7221227339478d0fcc8&dexId=1000

/gethistoricaltransactions

Get the historical transactions focusing on swaps associated with a specific pool address.

GET https://historicaltrade.api.expand.network/dex/gethistoricaltransactions

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

endBlock

String

Last block of the range.

startBlock

String

Starting block of the range.

poolAddress*

String

Pool address whose transactions is to be fetched.

https://historicaltrade.api.expand.network/dex/gethistoricaltransactions?poolAddress=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&dexId=1000

/gethistoricalpoolchartdata

Get the data the OHCLV (Open, High, Close, Low, and Volume) within the specified time interval for pool on Uniswap V2.

GET https://api.expand.network/dex/gethistoricalpoolchartdata

Query Parameter

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

interval

String

15 mins(by default), 30 mins, 60 mins, and 90 mins.

limit

String

No of iteration. Start limit is 100 and maximum limit is 500.

poolAddress*

String

Pool address whose transactions is to be fetched.

rpc

String

Remote procedural call URL.

https://api.expand.network/dex/gethistoricalpoolchartdata?limit=100&interval=15m&dexId=1000&poolAddress=0x517F9dD285e75b599234F7221227339478d0FcC8

/getpoolchartdata

Get the data for the pool and obtain the OHCL (Open, High, Close, Low) prices within the specified time interval.

GET https://historicaltrade.api.expand.network/dex/getpoolchartdata

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

interval

String

15 mins(by default), 30 mins, 60 mins, and 90 mins.

poolAddress*

String

Pool address whose transactions is to be fetched.

https://historicaltrade.api.expand.network/dex/getpoolchartdata?dexId=1000&poolAddress=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&interval=60

/getpooltradedata

Get the trade data from the pool within a specified block range, for the specified event type

GET https://historicaltrade.api.expand.network/dex/getpooltradedata

Query Parameters

NameTypeDescription

dexId*

String

Refer to DEX ID page for details.

endBlock

String

Last block of the range.

startBlock

String

Starting block of the range.

poolAddress*

String

Pool address whose data is to be fetched.

eventType

String

Transfer, Swap, Burn or Mint(by default).

https://historicaltrade.api.expand.network/dex/getpooltradedata?poolAddress=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&dexId=1000&eventType=Burn

/swap

Initiate a swap transaction on a specified DEX.

POST https://api.expand.network/dex/swap

Request Body

NameTypeDescription

dexId

String

Refer to the DEX ID page for details.

path*

Array

Comma-separated values of token addresses, inside an array, to swap.

amountIn*

String

Amount of token to be swapped.

amountOutmin*

String

Minimum amount accepted as the result of swap.

to*

String

Address of the recipient of the token.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

involveBaseToken

String

If a base token is involved in the swap; 0 for erc20 -> erc20, 1 for base -> erc20 ("from" address should be of equivalent wrapped token), 2 for erc20 -> base ("to" address should be of equivalent wrapped token).

By default, 0 .

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total swap value. By default, 1.

0 <= slippage value <= 100

{
    "dexId":"1000",
    "amountIn": "1000000000000000",
    "amountOutMin": "0",
    "path": ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","0x6B175474E89094C44Da98b954EedeAC495271d0F"],
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1665990894",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "173376"
}

With gasPriority:

{
    "dexId": "1000",
    "amountIn": "10000000000",
    "amountOutMin": "0",
    "path": [
        "0x6B175474E89094C44Da98b954EedeAC495271d0F",
        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
    ],
    "to": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "deadline": "1765990894",
    "from": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "gas": "273376",
    "gasPriority": "high"
}

With Slippage:

{
    "dexId": "1000",
    "amountIn": "10000000000000",
    "amountOutMin": "0",
    "path": [
        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "0x6B175474E89094C44Da98b954EedeAC495271d0F"
    ],
    "to": "0x22cf65ae3fa16d6379e72f4b4c2401c1b7c69731",
    "deadline": "1701931771",
    "from": "0x22cf65ae3fa16d6379e72f4b4c2401c1b7c69731",
    "gas": "173376",
    "slippage": "10"
}

/addliquidity

Add liquidity to a specified pool in a specified DEX.

POST https://api.expand.network/dex/addliquidity

Request Body

NameTypeDescription

dexId

String

Refer to the DEX ID page for details.

tokenA*

String

Address of the first token being added.

tokenB*

String

Address of the second token being added.

amountADesired*

String

Desired amount of token A.

amountBDesired*

String

Desired amount of token B.

amountAMin*

String

Minimum amount of token A.

amountBMin*

String

Minimum amount of token B.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

to*

String

Address of the recipient of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1.

0 <= slippage value <= 100

{
    "dexId": "1000",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F", 
    "amountADesired": "1000000000000000",
    "amountBDesired": "1332066335118442626",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",  
    "deadline": "166978170",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",  
    "gas": "230000"
}

With gasPriority:

{
    "dexId": "1000",
    "tokenA": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", 
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F", 
    "amountADesired": "1000",
    "amountBDesired": "997726184637093",
    "amountAMin": "0",
    "amountBMin": "0",
    "poolFees":"3000",
    "from": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "to":"0x356dB816602c85e2075774bB77D13995c8Bab023",
    "deadline":"1699965863785",
    "gas": "0",
    "gasPriority":"medium"
}

With Slippage:

{
    "dexId": "1000",
    "tokenA": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    "tokenB": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "amountADesired": "1000000",
    "amountBDesired": "640706397834636",
    "amountAMin": "100",
    "amountBMin": "100",
    "to": "0x22cf65Ae3fa16d6379E72F4B4c2401c1B7C69731",
    "deadline": "1712015780705",
    "from": "0x22cf65Ae3fa16d6379E72F4B4c2401c1B7C69731",
    "gas": "230000",
    "slippage": "5.00001"
}

/removeliquidity

Remove liquidity from a specified pool for a specified DEX.

POST https://api.expand.network/dex/removeliquidity

Request Body

NameTypeDescription

dexId

String

Refer to the DEX ID page for details.

tokenA*

String

Address of the first token being removed.

tokenB*

String

Address of the second token being removed.

liquidity*

String

Total amount of liquidity to be removed from the given pool.

amountAMin*

String

Minimum amount of Token A.

amountBMin*

String

Minimum amount of Token B.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

to*

String

Address of the recipient of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1. 0 <= slippage value <= 100

{
    "dexId": "1000",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "liquidity": "20759430672661383",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1669720626",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "420000"
}

With gasPriority:

{
    "dexId": "1000",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "liquidity": "20759430672661383",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1669720626",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "420000",
    "gasPriority": "high"
}

With slippage:

{
    "dexId": "1000",
    "tokenA": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "tokenB": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "liquidity": "3834508059710445",
    "amountAMin": "100",
    "amountBMin": "100",
    "to": "0x4970798F8E5a77598CA4Da778eb6D12303AEefc9",
    "deadline": "1669720626",
    "from": "0x4970798F8E5a77598CA4Da778eb6D12303AEefc9",
    "gas": "420000",
    "slippage": "5.01"
}

Last updated