# DEX & Aggregators

Provides connectivity across the various **decentralized exchanges** available on the EVM and Non-EVM chains.&#x20;

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

<table><thead><tr><th width="232">Name</th><th width="182.4">Type</th><th>Description</th></tr></thead><tbody><tr><td>getprice</td><td>Read</td><td>Returns the swap quotation for the given token pairs for the specified DEX.</td></tr><tr><td>getuserliquidity</td><td>Read</td><td>Returns the balance of a particular token pair of an account.</td></tr><tr><td>getpoolliquidity</td><td>Read</td><td>Returns the total liquidity for a specified pool.</td></tr><tr><td>gettokenliquidity</td><td>Read</td><td>Returns the individual token liquidity within the specified liquidity pool.</td></tr><tr><td>getliquidityholders</td><td>Read</td><td>Returns the total number of liquidity holders in the specified pool.</td></tr><tr><td>getindividualposition</td><td>Read</td><td>Returns the liquidity position for a specified user address across all the pools for a specified DEX.</td></tr><tr><td>getliquiditysources</td><td>Read</td><td>Get the liquidity sources for the specified dex aggregator(on the basis of chain), supported by expand.network.</td></tr><tr><td><a href="#getpools"><em><mark style="color:blue;">getpools</mark></em></a></td><td>Read</td><td>Returns a list of all the quotes for a pool on different DEXs.</td></tr><tr><td>gethistoricaltimeseries</td><td>Read</td><td>Get the historical time series transactions for a specific pool address.</td></tr><tr><td>gethistoricaltransactions</td><td>Read</td><td>Get the historical transactions focusing on swaps associated with a specific pool address.</td></tr><tr><td>getpoolchartdata</td><td>Read</td><td>Get the data for the pool and obtain the OHCL (Open, High, Close, Low) prices within the specified time interval.</td></tr><tr><td>getpooltradedata</td><td>Read</td><td>Get the trade data from the pool within a specified block range, for the specified event type.</td></tr><tr><td>getpoolindividualliquidity</td><td>Read</td><td>Get all user addresses, block numbers, and token position details for a specified pool address. Available for Uniswap V2,V3 and Sushiswap only.</td></tr><tr><td><mark style="color:blue;">getwalletposition</mark></td><td>Read</td><td>Get detailed information for user transactions on various DEXs, including transaction type, block-related details, decoded parameters and many more.</td></tr><tr><td>quoteaggregator</td><td>Read</td><td>Retrieves quotes from various DEXs &#x26; 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.</td></tr><tr><td>swap</td><td>Write</td><td>Initiate a swap transaction on a specified DEX.</td></tr><tr><td>addliquidity</td><td>Write</td><td>Add liquidity to a specified pool in a specified DEX.</td></tr><tr><td>removeliquidity</td><td>Write</td><td>Remove liquidity from a specified pool for a specified DEX.</td></tr><tr><td>swapaggregator</td><td>Write</td><td>Returns the aggregated prepared swap quotes for every DEX, in which the pair address is present.</td></tr></tbody></table>

{% hint style="info" %}
Every DEX requires a different set of parameters to perform the common operations. Please refer to the sub-sections for details.&#x20;
{% endhint %}

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.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/dex/getpools`

#### Query Parameters

| Name                                       | Type   | Description                                                                                        |
| ------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>    | String | Comma-separated values of Dex Id. Refer to the [DEX ID](../important-ids/dex-id) page for details. |
| path<mark style="color:red;">\*</mark>     | String | Comma-separated values of token pair.                                                              |
| amountIn<mark style="color:red;">\*</mark> | String | Amount of token.                                                                                   |

{% tabs %}
{% tab title="Sample Request" %}
```url
https://api.expand.network/dex/getpools?dexId=1500,1400,1300&path=0x6b175474e89094c44da98b954eedeac495271d0f,0xdac17f958d2ee523a2206206994597c13d831ec7&amountIn=100000000000000000
```
{% endtab %}

{% tab title="Sample Response" %}
```json
{
    "status": 200,
    "msg": "success",
    "data": [
        {
            "dexId": "1300",
            "value": "99431"
        },
        {
            "dexId": "1400",
            "value": "130999"
        },
        {
            "dexId": "1500",
            "value": "99977"
        }
    ]
}
```
{% endtab %}
{% endtabs %}

### /quoteaggregator

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

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/dex/quoteaggregator`

#### Query Parameters

| Name                                       | Type   | Description                                                           |
| ------------------------------------------ | ------ | --------------------------------------------------------------------- |
| chainId                                    | String | Refer to the [Chain ID ](../important-ids/chain-id)page for details.  |
| path<mark style="color:red;">\*</mark>     | String | Comma-separated values of token pair.                                 |
| amountIn<mark style="color:red;">\*</mark> | String | Amount of token.                                                      |
| chainSymbol                                | String | Refer to the [Chain ID ](../important-ids/chain-id)page for details.  |
| excludedDexes                              | String | Comma-separated values of dexes to exclude.                           |

{% tabs %}
{% tab title="Sample Request" %}
```url
https://api.expand.network/dex/quoteaggregator?path=0xdac17f958d2ee523a2206206994597c13d831ec7%2C0x6B175474E89094C44Da98b954EedeAC495271d0F&amountIn=1000000&chainId=1&excludedDexes=1000,1100,1400
```
{% endtab %}

{% tab title="Sample Response" %}
```json
{
    "status": 200,
    "msg": "success",
    "data": [
        {
            "dexName": "UniswapV3",
            "dexId": "1300",
            "amountIn": "1000000",
            "path": [
                "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "0x6B175474E89094C44Da98b954EedeAC495271d0F"
            ],
            "amountsOut": [
                "1000000",
                "992453714315716405"
            ]
        },
        {
            "dexName": "CurveV2",
            "dexId": "1500",
            "amountIn": "1000000",
            "path": [
                "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "0x6B175474E89094C44Da98b954EedeAC495271d0F"
            ],
            "amountsOut": [
                "1000000",
                "1000311335077777268"
            ]
        },
        {
            "dexName": "0x",
            "dexId": "1600",
            "amountIn": "1000000",
            "path": [
                "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "0x6B175474E89094C44Da98b954EedeAC495271d0F"
            ],
            "amountsOut": [
                "1000000",
                "1015039771697507808"
            ]
        },
        {
            "dexName": "1inch",
            "dexId": "1700",
            "amountIn": "1000000",
            "path": [
                "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "0x6B175474E89094C44Da98b954EedeAC495271d0F"
            ],
            "amountsOut": [
                "1000000",
                "994152586419056980"
            ]
        }
    ]
}
```
{% endtab %}
{% endtabs %}

### /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.

<mark style="color:blue;">`GET`</mark> `https://historicallp.api.expand.network/dex/getwalletposition`

#### Query Parameters

| Name                                      | Type   | Description                                                               |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------- |
| pageToken                                 | String | <p>The page number that the user wants to fetch.</p><p>By default, 1.</p> |
| address<mark style="color:red;">\*</mark> | String | Public address of the user.                                               |

{% tabs %}
{% tab title="Sample Request" %}
```url
https://historicallp.api.expand.network/dex/getwalletposition?address=0xEf1B32354C3d8A273331Cd532D1576bB819B6E36&pageToken=3
```
{% endtab %}

{% tab title="Sample Response" %}
```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "currentPage": "3",
        "totalPages": "3",
        "transactions": {
            "UniswapV3": [
                {
                    "block_signed_at": "2024-02-18T14:02:11Z",
                    "block_height": 19255151,
                    "tx_offset": 249,
                    "log_offset": 402,
                    "tx_hash": "0x98ff38d750c787d0c34d7aa51051be6034943659a575e55d088ed0c3ad255a9e",
                    "raw_log_topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x00000000000000000000000073ea3d8ba3d7380201b270ec504b33ed5e478542",
                        "0x000000000000000000000000e37e799d5077682fa0a244d46e5649f71457bd09"
                    ],
                    "sender_contract_decimals": 6,
                    "sender_name": "USD Coin",
                    "sender_contract_ticker_symbol": "USDC",
                    "sender_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                    "sender_address_label": null,
                    "raw_log_data": "0x000000000000000000000000000000000000000000000000000000023a5e3b6f",
                    "decoded": {
                        "name": "Transfer",
                        "signature": "Transfer(indexed address from, indexed address to, uint256 value)",
                        "params": [
                            {
                                "name": "from",
                                "type": "address",
                                "indexed": true,
                                "decoded": true,
                                "value": "0x73ea3d8ba3d7380201b270ec504b33ed5e478542"
                            },
                            {
                                "name": "to",
                                "type": "address",
                                "indexed": true,
                                "decoded": true,
                                "value": "0xe37e799d5077682fa0a244d46e5649f71457bd09"
                            },
                            {
                                "name": "value",
                                "type": "uint256",
                                "indexed": false,
                                "decoded": true,
                                "value": "9569188719"
                            }
                        ]
                    }
                }
            ],
            "UniswapV2": [
                {
                    "block_signed_at": "2024-01-14T12:17:47Z",
                    "block_height": 19005074,
                    "tx_offset": 79,
                    "log_offset": 1167,
                    "tx_hash": "0xbea1249137babc68449502e14c293fc02bd4679711231a241e4475c53261624f",
                    "raw_log_topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x000000000000000000000000de0b295669a9fd93d5f28d9ec85e40f4cb697bae",
                        "0x00000000000000000000000052e2e6b3ba385ed9690eef11f72b2fe27ba1f8ca"
                    ],
                    "sender_contract_decimals": 0,
                    "sender_name": "# UsdcLB.com",
                    "sender_contract_ticker_symbol": "# UsdcLB.com - Visit to claim bonus",
                    "sender_address": "0xbbac5b019876534c3c399f56e150684c5015f670",
                    "sender_address_label": null,
                    "raw_log_data": "0x000000000000000000000000000000000000000000000000000000000000204f",
                    "decoded": {
                        "name": "Transfer",
                        "signature": "Transfer(indexed address from, indexed address to, uint256 value)",
                        "params": [
                            {
                                "name": "from",
                                "type": "address",
                                "indexed": true,
                                "decoded": true,
                                "value": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae"
                            },
                            {
                                "name": "to",
                                "type": "address",
                                "indexed": true,
                                "decoded": true,
                                "value": "0x52e2e6b3ba385ed9690eef11f72b2fe27ba1f8ca"
                            },
                            {
                                "name": "value",
                                "type": "uint256",
                                "indexed": false,
                                "decoded": true,
                                "value": "8271"
                            }
                        ]
                    }
                }
            ],
            "SushiSwapV2": [
                {
                    "block_signed_at": "2024-01-14T12:17:47Z",
                    "block_height": 19005074,
                    "tx_offset": 79,
                    "log_offset": 1264,
                    "tx_hash": "0xbea1249137babc68449502e14c293fc02bd4679711231a241e4475c53261624f",
                    "raw_log_topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x000000000000000000000000de0b295669a9fd93d5f28d9ec85e40f4cb697bae",
                        "0x0000000000000000000000001e888882d0f291dd88c5605108c72d414f29d460"
                    ],
                    "sender_contract_decimals": 0,
                    "sender_name": "# UsdcLB.com",
                    "sender_contract_ticker_symbol": "# UsdcLB.com - Visit to claim bonus",
                    "sender_address": "0xbbac5b019876534c3c399f56e150684c5015f670",
                    "sender_address_label": null,
                    "raw_log_data": "0x000000000000000000000000000000000000000000000000000000000000204f",
                    "decoded": {
                        "name": "Transfer",
                        "signature": "Transfer(indexed address from, indexed address to, uint256 value)",
                        "params": [
                            {
                                "name": "from",
                                "type": "address",
                                "indexed": true,
                                "decoded": true,
                                "value": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae"
                            },
                            {
                                "name": "to",
                                "type": "address",
                                "indexed": true,
                                "decoded": true,
                                "value": "0x1e888882d0f291dd88c5605108c72d414f29d460"
                            },
                            {
                                "name": "value",
                                "type": "uint256",
                                "indexed": false,
                                "decoded": true,
                                "value": "8271"
                            }
                        ]
                    }
                }
            ],
            "BalancerV2": [],
            "PancakeV2": [],
            "CurveV2": [],
            "extraTransactions": []
        }
    }
}
```
{% endtab %}
{% endtabs %}

### /swapaggregator

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

<mark style="color:green;">`POST`</mark> `https://api.expand.network/dex/swapaggregator`

#### Request Body

| Name                                       | Type    | Description                                                                            |
| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------- |
| chainId                                    | String  | Refer to the [Chain ID ](../important-ids/chain-id)page for details.                   |
| path<mark style="color:red;">\*</mark>     | String  | Comma-separated values of token pair.                                                  |
| amountIn<mark style="color:red;">\*</mark> | String  | Amount of token.                                                                       |
| chainSymbol                                | String  | Refer to the [Chain ID ](../important-ids/chain-id)page for details.                   |
| from<mark style="color:red;">\*</mark>     | String  | Address of the sender of the token.                                                    |
| gas<mark style="color:red;">\*</mark>      | 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<mark style="color:red;">\*</mark>       | String  | Address of the recipient of the token.                                                 |
| gasPriority                                | String  | low, medium, or high.                                                                  |

{% tabs %}
{% tab title="Sample Request" %}
```json
{
    "path":["0xdac17f958d2ee523a2206206994597c13d831ec7","0x6B175474E89094C44Da98b954EedeAC495271d0F"],
    "amountIn": "1000000000000000" ,
    "gas":  "800000" ,
    "from": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "to": "0x356dB816602c85e2075774bB77D13995c8Bab023",
    "chainId": "1",
    "bestSwap": true
}
```
{% endtab %}

{% tab title="Sample Response" %}
```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "path": [
            "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "0x6B175474E89094C44Da98b954EedeAC495271d0F"
        ],
        "amountIn": "1000000000000000",
        "dexName": "0x",
        "dexId": "1600",
        "chainId": "1",
        "amountsOut": "68406348077699870412427961",
        "transactionPayload": {
            "from": "0x356dB816602c85e2075774bB77D13995c8Bab023",
            "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
            "value": "0",
            "gas": "800000",
            "data": "0x415565b0000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000380488990848cf40c95ff600000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000001ca000000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000760000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000c200000000000000000000000000000000000000000000000000000000000000d800000000000000000000000000000000000000000000000000000000000000fe0000000000000000000000000000000000000000000000000000000000000116000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000000000000000144000000000000000000000000000000000000000000000000000000000000015c0000000000000000000000000000000000000000000000000000000000000174000000000000000000000000000000000000000000000000000000000000018a00000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000143757276650000000000000000000000000000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000028079e26b7fdc0fc33a10000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c73df02124000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002556e697377617056320000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000000545d1f2e7711e185d2200000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000f164fc0ec4e93095b804a4795bbe1e041497b92a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000143757276650000000000000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000002b4669c49d3ac9e11fedf00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000a5407eae9ba41422680e2e00537571bcc53efbfda6417ed6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000001b7fbb6ddcdc68b5c119f000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000042dac17f958d2ee523a2206206994597c13d831ec7000064a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000646b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f53796e61707365000000000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000001a2acd5c34fdef88bc7f5000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000800000000000000000000000001116898dda4015ed8ddefb84b6e8bc24528af2d89169558600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b446f646f563200000000000000000000000000000000000000000000000000000000000000000000000016bcc41e90000000000000000000000000000000000000000000000172bf43bcf81c46997206000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000400000000000000000000000003058ef90929cb8180174d74c507176cca6835d730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000025375736869537761700000000000000000000000000000000000000000000000000000000000000000005af3107a400000000000000000000000000000000000000000000001206bd159b78d8dcc42c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000000be5a3083ea8c50764422000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bdac17f958d2ee523a2206206994597c13d831ec70000646b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000002556e6973776170563200000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000007384a5c7e97c7f487bc8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000f164fc0ec4e93095b804a4795bbe1e041497b92a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000001942616c616e6365725632000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000000460e85ccfe4d6f5611a8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002079c58f70905f734641735bc61e45c19dd9ad60bc0000000000000000000004e700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e900000000000000000000000000000000000000000000000391c72d1f80ddf34d2be000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000042dac17f958d2ee523a2206206994597c13d831ec70001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e90000000000000000000000000000000000000000000000023f59f9b49322ad7a98a000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bdac17f958d2ee523a2206206994597c13d831ec70001f46b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000001c63a4e353defe854318000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000042dac17f958d2ee523a2206206994597c13d831ec7000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb86b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000000f2967365905c1ea0205000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000042dac17f958d2ee523a2206206994597c13d831ec70001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f46b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000000e2f8231f62ace053698000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000042dac17f958d2ee523a2206206994597c13d831ec7000bb82260fac5e5542a773aa44fbcfedf7c193bc2c599000bb86b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c43727970746f436f6d00000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000000af3dd13213ad902a2b2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000ceb90e4c17d626be0facd78b79c9c87d7ca181b300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000253686962615377617000000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000000870dbfd814b5d36022b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000003f7724180aa6b939894b5ca4314783b0b36b32900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000002556e6973776170563200000000000000000000000000000000000000000000000000000000000000000016bcc41e9000000000000000000000000000000000000000000000000848951b626417dbc1fe000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000f164fc0ec4e93095b804a4795bbe1e041497b92a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000158b0996829befd120b4000000000000000000000000ad01c20d5886137e056775af56915de824c8fce5000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000000869584cd000000000000000000000000100000000000000000000000000000000000001100000000000000000000000000000000fd579806b7c202d6ff5c59f88e6cdb1d"
        }
    }
}
```
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority:**

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

{% tab title="Sample Response" %}
**With gasPriority:**

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "UniswapV2": {
            "from": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d",
            "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
            "value": "0",
            "gas": "129281",
            "data": "0x38ed1739000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000a8062eeaa97b0cc055510ea125faa2cb37c1b3d0000000000000000000000000000000000000000000000000000018c32f0c64d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
        },
        "SushiswapV2": {
            "from": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d",
            "to": "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",
            "value": "0",
            "gas": "130412",
            "data": "0x38ed1739000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000a8062eeaa97b0cc055510ea125faa2cb37c1b3d0000000000000000000000000000000000000000000000000000018c32f0c64d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
        },
        "UniswapV3": {
            "from": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d",
            "to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
            "value": "0",
            "gas": "135138",
            "data": "0xac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e4472b43f3000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000002b39fdff3ce100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000a8062eeaa97b0cc055510ea125faa2cb37c1b3d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000"
        },
        "BalancerV2": {
            "from": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d",
            "to": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
            "value": "0",
            "gas": "900000",
            "data": "0x52bbbe2900000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000a8062eeaa97b0cc055510ea125faa2cb37c1b3d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a8062eeaa97b0cc055510ea125faa2cb37c1b3d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004b98afd92ce70000000000000000000000000000000000000000000000000000018c32f0c64dd6855f0a3c26a1b1b2785ba2604758c0878169bc00010000000000000000031700000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000003265ca90c89a00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000"
        },
        "0x": {
            "from": "0x0a8062EeAA97b0CC055510eA125faA2cb37C1b3d",
            "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
            "value": "0",
            "gas": "900000",
            "data": "0x415565b00000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000039260375dfd000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000012556e6973776170563300000000000000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000393bfdd33f44000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000426b175474e89094c44da98b954eedeac495271d0f0001f45d3a536e4d6dbd6114cc1ead35777bab948e3643000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000015fa5d5f74000000000000000000000000ad01c20d5886137e056775af56915de824c8fce5000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000000869584cd000000000000000000000000100000000000000000000000000000000000001100000000000000000000000000000000d81c918122efc4f7e183db03a87bef01"
        }
    }
}
```
{% endtab %}
{% endtabs %}

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

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2F8iYVy1urZXVveB53cIdZ%2FDEX_SWAP%20(2).jpeg?alt=media&#x26;token=23fd2985-230f-42f1-804c-69d4721ddab8" alt=""><figcaption><p>Sequence Diagram for swap</p></figcaption></figure>

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

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2FBjLdbQ6khRgTJece5FPj%2FDEX_SWAP%20(4).jpeg?alt=media&#x26;token=ed3bbcd3-0a5a-4705-837b-fbe4032548da" alt=""><figcaption><p>Sequence diagram for addLiquidity</p></figcaption></figure>

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

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2FFrY9gMVy3mNUbIiwJT6U%2FDEX_SWAP%20(3).jpeg?alt=media&#x26;token=015461db-2a40-4ea1-9912-a3d1619527db" alt=""><figcaption><p>Sequence diagram for removeLiquidity</p></figcaption></figure>
