DEX & Aggregators

Provides connectivity across the various decentralized exchanges available on the EVM and Non-EVM chains.

Following are the common APIs implemented for all the DEXs :-

Name
Type
Description

getprice

Read

Returns the swap quotation for the given token pairs for the specified DEX.

getuserliquidity

Read

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

getpoolliquidity

Read

Returns the total liquidity for a specified pool.

gettokenliquidity

Read

Returns the individual token liquidity within the specified liquidity pool.

getliquidityholders

Read

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

getindividualposition

Read

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

getliquiditysources

Read

Get the liquidity sources for the specified dex aggregator(on the basis of chain), supported by expand.network.

Read

Returns a list of all the quotes for a pool on different DEXs.

gethistoricaltimeseries

Read

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

gethistoricaltransactions

Read

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

getpoolchartdata

Read

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

getpooltradedata

Read

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

getpoolindividualliquidity

Read

Get all user addresses, block numbers, and token position details for a specified pool address. Available for Uniswap V2,V3 and Sushiswap only.

getwalletposition

Read

Get detailed information for user transactions on various DEXs, including transaction type, block-related details, decoded parameters and many more.

quoteaggregator

Read

Retrieves quotes from various DEXs & aggregators in a unified manner. For a specified pair address, this endpoint will return the respective quotes for each DEX in which the pair address is present.

swap

Write

Initiate a swap transaction on a specified DEX.

addliquidity

Write

Add liquidity to a specified pool in a specified DEX.

removeliquidity

Write

Remove liquidity from a specified pool for a specified DEX.

swapaggregator

Write

Returns the aggregated prepared swap quotes for every DEX, in which the pair address is present.

Every DEX requires a different set of parameters to perform the common operations. Please refer to the sub-sections for details.

If the user wants to get the list of the price of the pool on multiple DEXs, they can do the same using /getpools endpoint.

/getpools

Returns a list of all the quotes for a pool on different DEXs.

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

Query Parameters

Name
Type
Description

dexId*

String

Comma-separated values of Dex Id. Refer to the DEX ID page for details.

path*

String

Comma-separated values of token pair.

amountIn*

String

Amount of token.

https://api.expand.network/dex/getpools?dexId=1500,1400,1300&path=0x6b175474e89094c44da98b954eedeac495271d0f,0xdac17f958d2ee523a2206206994597c13d831ec7&amountIn=100000000000000000

/quoteaggregator

Returns a list of all the quotes for a pool on different DEXs.

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

Query Parameters

Name
Type
Description

chainId

String

Refer to the Chain ID page for details.

path*

String

Comma-separated values of token pair.

amountIn*

String

Amount of token.

chainSymbol

String

Refer to the Chain ID page for details.

excludedDexes

String

Comma-separated values of dexes to exclude.

https://api.expand.network/dex/quoteaggregator?path=0xdac17f958d2ee523a2206206994597c13d831ec7%2C0x6B175474E89094C44Da98b954EedeAC495271d0F&amountIn=1000000&chainId=1&excludedDexes=1000,1100,1400

/getwalletposition

Get detailed information for user transactions on various DEXs, including transaction type, block-related details, decoded parameters and many more.Available for Uniswap V2, Uniswap V3, SushiSwap V2, Curve V2, and Balancer V2.

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

Query Parameters

Name
Type
Description

pageToken

String

The page number that the user wants to fetch.

By default, 1.

address*

String

Public address of the user.

https://historicallp.api.expand.network/dex/getwalletposition?address=0xEf1B32354C3d8A273331Cd532D1576bB819B6E36&pageToken=3

/swapaggregator

Returns the aggregated prepared swap quotes for every DEX, in which the pair address is present.

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

Request Body

Name
Type
Description

chainId

String

Refer to the Chain ID page for details.

path*

String

Comma-separated values of token pair.

amountIn*

String

Amount of token.

chainSymbol

String

Refer to the Chain ID page for details.

from*

String

Address of the sender of the token.

gas*

String

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

excludedDexes

String

Comma-separated values of dexes to exclude.

bestSwap

Boolean

If true, prepared transaction from the dex providing best swap value will be provided.

to*

String

Address of the recipient of the token.

gasPriority

String

low, medium, or high.

{
    "path":["0xdac17f958d2ee523a2206206994597c13d831ec7","0x6B175474E89094C44Da98b954EedeAC495271d0F"],
    "amountIn": "1000000000000000" ,
    "gas":  "800000" ,
    "from": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "to": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "chainId": "1",
    "bestSwap": true
}

With gasPriority:

{
    "path": [
        "0x6b175474e89094c44da98b954eedeac495271d0f",
        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
    ],
    "amountIn": "100000000000000000",
    "gas": "900000",
    "gasPriority": "medium",
    "from": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d",
    "to": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d"
}

Following is a sequence diagram for swap() process:-

Following is a sequence diagram for addLiquidity() process:-

Following is a sequence diagram for removeLiquidity() process:-

Last updated

#553: ENC-2526-LIDO

Change request updated