# DragonSwap

### Supported Chains

Available on Kaia **Mainnet.**

### Available Endpoints:

*Click on the endpoint to jump to the section with full details*

* [<mark style="color:blue;">/getprice</mark>](#getprice) <mark style="color:blue;">`GET`</mark> - Returns the swap quotation for a given token pair on Klayswap V3.
* [<mark style="color:blue;">/getuserliquidity</mark>](#getuserliquidity) <mark style="color:blue;">`GET`</mark> - Returns the balance of a particular token pair of accounts.&#x20;
* [<mark style="color:blue;">/getpoolliquidity</mark>](#getpoolliquidity) <mark style="color:blue;">`GET`</mark> - Returns the total liquidity for a specified pool.
* [<mark style="color:blue;">/gettokenliquidity</mark>](#gettokenliquidity) <mark style="color:blue;">`GET`</mark> - Returns the individual token liquidity within the specified liquidity pool.
* [/<mark style="color:blue;">swap</mark>](#swap) <mark style="color:green;">`POST`</mark> - Initiate a swap transaction on a specified DEX.&#x20;
* [/<mark style="color:blue;">addliquidity</mark>](#addliquidity) <mark style="color:green;">`POST`</mark> - Add liquidity to a specified pool in a specified DEX.&#x20;
* [<mark style="color:blue;">/removeliquidity</mark>](#removeliquidity) <mark style="color:green;">`POST`</mark> - Remove liquidity from a specified pool in a specified DEX.&#x20;

### DEX IDs

Many endpoints have a parameter where you can provide a DEX ID.&#x20;

Below is a list of DEX IDs related to DragonSwap V3. For a complete list and more information, please see the [DEX ID](/ids/dex-ids.md) page.

| DEX Name      | Chain        | DEX ID |
| ------------- | ------------ | ------ |
| DragonSwap V3 | Kaia Mainnet | 3700   |

## Endpoint Details

### /getprice

Returns the swap quotation for the given token pair.

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

#### Query Parameters

| Name                                       | Type   | Description                                                             |
| ------------------------------------------ | ------ | ----------------------------------------------------------------------- |
| rpc                                        | String | Remote procedural call URL.                                             |
| dexId                                      | String | Refer to the [DEX ID](/ids/dex-ids.md) page for details.                |
| path<mark style="color:red;">\*</mark>     | String | Comma separated values of token addresses whose price is to be fetched. |
| amountIn<mark style="color:red;">\*</mark> | String | Amount of token.                                                        |
| poolFees                                   | String | Different pool based on the fees. By default, it is selected as 10000.  |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/dex/getprice?path=0x0BA2bA407E80bcb8a314649d9bC12efEECC81519,0xd077A400968890Eacc75cdc901F0356c943e4fDb&amountIn=1000000000000000000&vsCurrencies=inr&dexId=3700&poolFees=2000
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "amountIn": "1000000000000000000",
        "path": [
            "0x0BA2bA407E80bcb8a314649d9bC12efEECC81519",
            "0xd077A400968890Eacc75cdc901F0356c943e4fDb"
        ],
        "amountsOut": [
            "1000000000000000000",
            "303"
        ],
        "prices": {
            "usd": [
                {
                    "0x0ba2ba407e80bcb8a314649d9bc12efeecc81519": "NA"
                },
                {
                    "0xd077a400968890eacc75cdc901f0356c943e4fdb": "1.0003293919119833"
                }
            ],
            "inr": [
                {
                    "0x0ba2ba407e80bcb8a314649d9bc12efeecc81519": "NA"
                },
                {
                    "0xd077a400968890eacc75cdc901f0356c943e4fdb": "87.8000000868226"
                }
            ]
        }
    }
}
```

{% endtab %}
{% endtabs %}

Returns the total liquidity for a specified pool.

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

#### Query Parameters

| Name                                          | Type   | Description                                          |
| --------------------------------------------- | ------ | ---------------------------------------------------- |
| rpc                                           | String | Remote procedural call URL.                          |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose liquidity is to be fetched.       |
| dexId                                         | String | Refer to [DEX ID](/ids/dex-ids.md) page for details. |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/dex/getpoolliquidity?dexId=3700&poolAddress=0xe6FAcE64967c6CDd53651d6ac97a04Bc9ef305d6
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "totalLiquidity": "2411396765347967129"
    }
}
```

{% endtab %}
{% endtabs %}

### /gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

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

#### Query Parameters

| Name                                          | Type   | Description                                          |
| --------------------------------------------- | ------ | ---------------------------------------------------- |
| rpc                                           | String | Remote procedural call URL.                          |
| poolAddress<mark style="color:red;">\*</mark> | String | The pool address.                                    |
| dexId<mark style="color:red;">\*</mark>       | String | Refer to [DEX ID](/ids/dex-ids.md) page for details. |

{% tabs %}
{% tab title="Sample Request" %}

```
https://api.expand.network/dex/gettokenliquidity?poolAddress=0xe6FAcE64967c6CDd53651d6ac97a04Bc9ef305d6&vsCurrencies=inr&dexId=3700
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "BOMB": "115964969965512332185276088",
        "USD₮": "18672491500",
        "prices": {
            "usd": [
                {
                    "BOMB": "NA"
                },
                {
                    "USD₮": "1.0003687497958833"
                }
            ],
            "inr": [
                {
                    "BOMB": "NA"
                },
                {
                    "USD₮": "87.81829804266268"
                }
            ]
        }
    }
}
```

{% endtab %}
{% endtabs %}

### /getpoolliquidity

Returns the total liquidity for a specified pool.

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

#### Query Parameters

| Name                                          | Type   | Description                                          |
| --------------------------------------------- | ------ | ---------------------------------------------------- |
| rpc                                           | String | Remote procedural call URL.                          |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose liquidity is to be fetched.       |
| dexId<mark style="color:red;">\*</mark>       | String | Refer to [DEX ID](/ids/dex-ids.md) page for details. |

{% tabs %}
{% tab title="Sample Request" %}

<pre class="language-url"><code class="lang-url"><strong>https://api.expand.network/dex/getpoolliquidity?dexId=3700&#x26;poolAddress=0xe6FAcE64967c6CDd53651d6ac97a04Bc9ef305d6
</strong></code></pre>

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "totalLiquidity": "2413131228303615201"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /getindividualposition

Returns the liquidity position for a specified user address across all the pools for the DEX.&#x20;

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

#### Query Parameters

| Name                                      | Type   | Description                                                                     |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------- |
| rpc                                       | String | Remote procedural call URL.                                                     |
| address<mark style="color:red;">\*</mark> | String | The public address of the liquidity holder.                                     |
| dexId                                     | String | Refer to [DEX ID](/ids/dex-ids.md) page for details.                            |
| poolAddresses                             | String | The pool Addresses whose liquidity is to be fetched. *(Comma-separated vaules)* |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/dex/getindividualposition?address=0x0ebc19619e8aa912d393ca321c0b6b4f7d98697d&dexId=3700
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "aggregatedLiquidity": "13220301478",
        "poolAddresses": {
            "WKLAYUSD₮": {
                "0x938779A1989e7635fdac1E040631255C3555708e": "13220301478"
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

### /getpool

&#x20;Returns poolAddress, tickSpacing, poolFees, tokensLiquidity and liquidity data based on tokenA and tokenB

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

#### Query Parameters

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/dex/getpool?dexId=3700&tokenA=0x0BA2bA407E80bcb8a314649d9bC12efEECC81519&tokenB=0xd077A400968890Eacc75cdc901F0356c943e4fDb
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": [
        {
            "poolAddress": "0xC4CE4D15E943a7556FD31311882c78329E7C6bCe",
            "poolFees": "100",
            "tickSpacing": "1",
            "tokensLiquidity": {
                "BOMB": "0",
                "USD₮": "3"
            },
            "liquidity": "0"
        },
        {
            "poolAddress": "0x23565CD113957Fd8F8792Ac1d8DC7e171770ba01",
            "poolFees": "500",
            "tickSpacing": "10",
            "tokensLiquidity": {
                "BOMB": "0",
                "USD₮": "1"
            },
            "liquidity": "0"
        },
        {
            "poolAddress": "0x7553E95a0F75Cd725877F2E46b1B3A92269340B4",
            "poolFees": "1000",
            "tickSpacing": "20",
            "tokensLiquidity": {
                "BOMB": "9",
                "USD₮": "8"
            },
            "liquidity": "0"
        },
        {
            "poolAddress": "0xe6FAcE64967c6CDd53651d6ac97a04Bc9ef305d6",
            "poolFees": "2000",
            "tickSpacing": "40",
            "tokensLiquidity": {
                "BOMB": "115964969965512332185276088",
                "USD₮": "18672491500"
            },
            "liquidity": "2411396765347967129"
        },
        {
            "poolAddress": "0x703F6f09003114bB4Ce09089D92b639e81e7939F",
            "poolFees": "5000",
            "tickSpacing": "100",
            "tokensLiquidity": {
                "BOMB": "24",
                "USD₮": "23"
            },
            "liquidity": "0"
        },
        {
            "poolAddress": "0x5f7259d3b662bd41d04955870C627f92197687a5",
            "poolFees": "10000",
            "tickSpacing": "200",
            "tokensLiquidity": {
                "BOMB": "8",
                "USD₮": "12"
            },
            "liquidity": "0"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### /swap

Initiate a swap transaction on a specified DEX.

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

#### Request Body

| Name                                       | Type   | Description                                                                                 |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>    | String | Refer to the [DEX ID](/ids/dex-ids.md) page for details.                                    |
| path<mark style="color:red;">\*</mark>     | Array  | Comma-separated values of token addresses, inside an array, to swap.                        |
| amountIn<mark style="color:red;">\*</mark> | String | Amount of token to be swapped.                                                              |
| amountOutmin                               | String | Minimum amount accepted as the result of swap.                                              |
| to<mark style="color:red;">\*</mark>       | String | Address of the recipient of the token.                                                      |
| deadline<mark style="color:red;">\*</mark> | String | Deadline for the transaction to be executed (UNIX Timestamp).                               |
| 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.                              |
| poolFees                                   | String | Different pool based on the fees. By default, it is selected as 10000.                      |
| gasPriority                                | String | low, medium, or high.                                                                       |
| slippage                                   | String | <p>Percentage of total swap value. <br>By default, 1.</p><p>0 <= slippage  value <= 100</p> |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "path": [
        "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","0xd077A400968890Eacc75cdc901F0356c943e4fDb"
    ],
    "amountIn": "1000000000000000000",
    "deadline": "1799212923",
    "to": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
    "from": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
    "gas": "1000000",
    "poolFees": "1000",
    "slippage": "10",
    "dexId": "3700"
}

```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "8217",
        "from": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
        "to": "0xA324880f884036E3d21a09B90269E1aC57c7EC8a",
        "gas": "184337",
        "value": "1000000000000000000",
        "data": "0xac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000104414bf38900000000000000000000000019aac5f612f524b754ca7e7c41cbfa2e981a4432000000000000000000000000d077a400968890eacc75cdc901f0356c943e4fdb00000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000ebc19619e8aa912d393ca321c0b6b4f7d98697d000000000000000000000000000000000000000000000000000000006b3dcf7b0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000018066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412210e8a00000000000000000000000000000000000000000000000000000000",
        "gasPrice": "41250000000",
        "estimationCheck": true,
        "referenceId": "2470e3e3df964964b461f8a0afa449d0"
    }
}
```

{% endtab %}
{% endtabs %}

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

```json
{
    "path": [
        "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","0xd077A400968890Eacc75cdc901F0356c943e4fDb"
    ],
    "amountIn": "1000000000000000000",
    "deadline": "1799212923",
    "to": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
    "from": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
    "gas": "1000000",
    "poolFees": "1000",
    "gasPriority": "high",
    "slippage": "10",
    "dexId": "3700"
}

```

{% endtab %}

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

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "8217",
        "from": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
        "to": "0xA324880f884036E3d21a09B90269E1aC57c7EC8a",
        "gas": "184337",
        "value": "1000000000000000000",
        "data": "0xac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000104414bf38900000000000000000000000019aac5f612f524b754ca7e7c41cbfa2e981a4432000000000000000000000000d077a400968890eacc75cdc901f0356c943e4fdb00000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000ebc19619e8aa912d393ca321c0b6b4f7d98697d000000000000000000000000000000000000000000000000000000006b3dcf7b0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000018066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412210e8a00000000000000000000000000000000000000000000000000000000",
        "gasPrice": "41250000000",
        "estimationCheck": true,
        "referenceId": "2470e3e3df964964b461f8a0afa449d0"
    }
}
```

{% endtab %}
{% endtabs %}

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

```json
{
    "path": [
        "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","0xd077A400968890Eacc75cdc901F0356c943e4fDb"
    ],
    "amountIn": "1000000000000000000",
    "deadline": "1799212923",
    "to": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
    "from": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
    "gas": "1000000",
    "poolFees": "1000",
    "gasPriority": "high",
    "slippage": "10",
    "dexId": "3700"
}

```

{% endtab %}

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

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "8217",
        "from": "0x0eBc19619e8aA912d393Ca321c0B6b4f7d98697D",
        "to": "0xA324880f884036E3d21a09B90269E1aC57c7EC8a",
        "gas": "184337",
        "value": "1000000000000000000",
        "data": "0xac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000104414bf38900000000000000000000000019aac5f612f524b754ca7e7c41cbfa2e981a4432000000000000000000000000d077a400968890eacc75cdc901f0356c943e4fdb00000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000ebc19619e8aa912d393ca321c0b6b4f7d98697d000000000000000000000000000000000000000000000000000000006b3dcf7b0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000018066000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412210e8a00000000000000000000000000000000000000000000000000000000",
        "gasPrice": "41250000000",
        "estimationCheck": true,
        "referenceId": "2470e3e3df964964b461f8a0afa449d0"
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.expand.network/integrations/dex-and-dex-aggregators/dragonswap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
