DEX & DEX Aggregators

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

Below are descriptions of the endpoints we support for DEXs and DEX Aggregators:

Please see the attached document for information about error messages you may encounter when transacting using these endpoints:https://docs.google.com/document/d/1SuBJwPOmvJtUUf-9QJiBcTr0l2zbWlusMTUOGfC8S50/edit?usp=sharing

/gettokenlist

Retrieves the details of token mapping for the top 100 trending tokens by default or retrieves the detail of specific token mapping by token address.Available for Uniswap V2, Uniswap V3, SushiSwap V2

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

Query Parameter

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

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

/gethistoricalpoolchartdata

Source OHCLV (Open, High, Close, Low, Volume) data for a specified pool address for a particular time interval (15, 30, 60, or 90 minutes). Available for Uniswap V2 and V3, Balancer, Curve V2, and Sushiswap.

/quoteaggregator

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

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

Query Parameters

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 more. Available for Uniswap V2, Uniswap V3, SushiSwap V2, Curve V2, and Balancer V2.

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

Query Parameters

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

{
  "path": [
    "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "0x6B175474E89094C44Da98b954EedeAC495271d0F"
  ],
  "amountIn": "1000000",
  "gas": "800000",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "cheapestSwap": true,
  "bestSwap": true,
  "chainId": "1"
}

With gasPriority:

{
  "path": [
    "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "0x6B175474E89094C44Da98b954EedeAC495271d0F"
  ],
  "amountIn": "1000000",
  "gas": "800000",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "cheapestSwap": true,
  "bestSwap": true,
  "chainId": "1",
  "gasPriority": "medium"
}

/dex/screen

This endpoint provides data on top activity pools across multiple DEXs (Uni V2, Uni V3, and Sushiswap V2) on Ethereum, offering key metrics like transactions, makers, buyers, sellers, volume, market cap, and liquidity with time intervals from 5 minutes to 24 hours. By default, this endpoint supports top 30 pools ranked by TVL, but the set can be customized.

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

Query Parameters

https://historicallp.api.expand.network/dex/screen

/swapwithapproval

Returns the approve and swap transaction on a DEX supported by Expand.

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

Request Body

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

/getliquiditybytick

This endpoint provides the amount of liquidity distributed across different ticks for UniswapV3, TraderJoe, and PancakeswapV3. Currently available for Ethereum,Avalanche, Binance and Polygon. The response includes the liquidity for the ticks.

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

Request Body

https://api.expand.network/dex/getliquiditybytick?dexId=1300&poolAddress=0xCBCdF9626bC03E24f779434178A73a0B4bad62eD&tickRange=10

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