โšกDEX & 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 :-

NameTypeDescription

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.

gettokenlist

Read

Retrieves the details of token mapping for the top 100 trending tokens (default ) or retrieves the details of a specific token mapping by token address.

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.

gethistoricalpoolchartdata

Read

Get the data for the OHCLV (Open, High, Close, Low, Volume) 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.

/gettokenlist

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

Query Parameter

NameTypeDescription

rpc

String

Remote procedural call URL.

tokenAddress

String

Address of the token.

https://api.expand.network/dex/gettokenlist

/getpools

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

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

Query Parameters

NameTypeDescription

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

NameTypeDescription

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

NameTypeDescription

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

NameTypeDescription

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