# STON.fi

### /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<mark style="color:red;">\*</mark>    | String | Refer to the [DEX ID](https://docs.expand.network/ids/dex-ids) 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.                                                                 |

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

```url
https://api.expand.network/dex/getprice?dexId=2300&path=EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA,EQB5Wjo7yXdaB70yBoN2YEv8iVPjAdMObf_Dq40ELLaPllNb&amountIn=1
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "amountIn": "1",
        "path": [
            "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA",
            "EQB5Wjo7yXdaB70yBoN2YEv8iVPjAdMObf_Dq40ELLaPllNb"
        ],
        "amountsOut": [
            "1",
            "22018"
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### /getuserliquidity

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

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

#### Query Parameters

| Name                                      | Type   | Description                                                                  |
| ----------------------------------------- | ------ | ---------------------------------------------------------------------------- |
| rpc                                       | String | Remote procedural call URL.                                                  |
| tokenA<mark style="color:red;">\*</mark>  | String | Address of token.                                                            |
| address<mark style="color:red;">\*</mark> | String | Public address of liquidity provider.                                        |
| dexId<mark style="color:red;">\*</mark>   | String | Refer to [DEX ID](https://docs.expand.network/ids/dex-ids) page for details. |
| tokenB<mark style="color:red;">\*</mark>  | String | Address of token.                                                            |

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

```url
https://api.expand.network/dex/getuserliquidity?tokenA=EQBT2Ee4Lx5w9uI7oMly5upXNs3ABWL_Fwk1uiM74gZCGaYt&tokenB=EQC47093oX5Xhb0xuk2lCr2RhS8rj-vul61u4W2UH5ORmG_O&address=UQAAjw7MBB_2-DvNKsjtOAPJBeqTK8iiDl8Xyv37zbIRbKrt&dexId=2300
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "tokenA": "12544748660283056",
        "tokenB": "295478740252006"
    }
}
```

{% 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](https://docs.expand.network/ids/dex-ids) page for details. |

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

```url
https://api.expand.network/dex/getpoolliquidity?poolAddress=EQAZFS5dJ8STrKcn5VnptYsoKILXbAYaDhdJJjbzUrNkDdH_&dexId=2300
```

{% endtab %}

{% tab title="Sample Response" %}

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

{% 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](https://docs.expand.network/ids/dex-ids) page for details. |

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

```
https://api.expand.network/dex/gettokenliquidity?poolAddress=EQD1c0gDs91J-9FzeiC_V9VbizFxDUs09P6eIO4Fe4l2WDbm&dexId=2300
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "tokenA": "19467094",
        "tokenB": "1028"
    }
}
```

{% 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](https://docs.expand.network/ids/dex-ids) 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.                                              |
| from<mark style="color:red;">\*</mark>     | String | Address of the sender of the token.                                                         |
| gas                                        | String | Maximum gas limit provided by the sender, for the transaction.                              |
| rpc                                        | String | Remote procedural call URL.                                                                 |
| slippage                                   | String | <p>Percentage of total swap value. <br>By default, 1.</p><p>0 <= slippage  value <= 100</p> |
| referralAddress                            | String | The referral address.                                                                       |
| queryId                                    | String | The query id, used to identify your transaction.                                            |

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

```json
{
    "dexId": "2300",
    "amountIn": "100",
    "amountOutMin": "0",
    "path": [
        "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA",
        "EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO"
    ],
    "from": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "referralAddress": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "queryId": "1",
    "involveBaseToken": "0",
    "gas": "123"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1100",
        "to": "0:73d110ca89db91fcb58feaa567a0448a8db0635a1c6076509dea8439c6d351be",
        "value": "320000000",
        "message": "te6ccsEBAgEAogAANwFnD4p+pQAAAAAAAAABFkgA7zuZAqJxsqAciTilI8/iTnGEeq62piAAHtRKd6wOcJwQPy5RAwEA0SWThWGAEPckSDVNSvvmJOKMGCE4qb+zE0NdQGXsIPpYy63RDznBAAxmMo2wxu/yQTySoV7u7+Con2csmcBloW0CrflBCQEr8ADGYyjbDG7/JBPJKhXu7v4KifZyyZwGWhbQKt+UEJASvoaQiNw="
    }
}
```

{% endtab %}
{% endtabs %}

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

```json
{
    "dexId": "2300",
    "amountIn": "100",
    "amountOutMin": "0",
    "path": [
        "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA",
        "EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO"
    ],
    "from": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "referralAddress": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "queryId": "1",
    "slippage": "10",
    "involveBaseToken": "0",
    "gas": "123"
}
```

{% endtab %}

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

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1100",
        "to": "0:73d110ca89db91fcb58feaa567a0448a8db0635a1c6076509dea8439c6d351be",
        "value": "320000000",
        "message": "te6ccsEBAgEAogAANwFnD4p+pQAAAAAAAAABFkgA7zuZAqJxsqAciTilI8/iTnGEeq62piAAHtRKd6wOcJwQPy5RAwEA0SWThWGAEPckSDVNSvvmJOKMGCE4qb+zE0NdQGXsIPpYy63RDznBAAxmMo2wxu/yQTySoV7u7+Con2csmcBloW0CrflBCQEr8ADGYyjbDG7/JBPJKhXu7v4KifZyyZwGWhbQKt+UEJASvoaQiNw="
    }
}
```

{% endtab %}
{% endtabs %}

### /addliquidity

Add liquidity to a specified pool in a specified DEX.

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

#### Request Body

| Name                                             | Type   | Description                                                                                                                |
| ------------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>          | String | Refer to the [DEX ID](https://docs.expand.network/integrations/dex-and-dex-aggregators/broken-reference) page for details. |
| tokenA<mark style="color:red;">\*</mark>         | String | Address of the first token being added.                                                                                    |
| tokenB<mark style="color:red;">\*</mark>         | String | Address of the second token being added.                                                                                   |
| amountADesired<mark style="color:red;">\*</mark> | String | Desired amount of token A.                                                                                                 |
| amountBDesired<mark style="color:red;">\*</mark> | String | Desired amount of token B.                                                                                                 |
| amountAMin<mark style="color:red;">\*</mark>     | String | Minimum amount of token A.                                                                                                 |
| amountBMin<mark style="color:red;">\*</mark>     | String | Minimum amount of token B.                                                                                                 |
| from<mark style="color:red;">\*</mark>           | String | Address of the sender of the token.                                                                                        |
| gas                                              | String | Maximum gas limit provided by the sender, for the transaction.                                                             |
| rpc                                              | String | Remote procedural call URL.                                                                                                |
| slippage                                         | String | <p>Percentage of total value. <br>By default, 1.</p><p>0 <= slippage  value <= 100</p>                                     |
| queryId                                          | String | The query id, used to identify your transaction.                                                                           |

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

```json
{
    "dexId": "2300",
    "tokenA": "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA",
    "tokenB": "EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO",
    "amountADesired": "1100",
    "amountBDesired": "411858",
    "amountAMin": "1",
    "amountBMin": "1",
    "queryId": "166978170",
    "from": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "gas": "230000"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "jetton0Transaction": {
            "chainId": "1100",
            "to": "0:73d110ca89db91fcb58feaa567a0448a8db0635a1c6076509dea8439c6d351be",
            "value": "320000000",
            "message": "te6ccsEBAgEAYQAAOAFpD4p+pQAAAAAJ8+J6IETIAO87mQKicbKgHIk4pSPP4k5xhHqutqYgAB7USnesDnCcED8uUQMBAE38+eWPgBD3JEg1TUr75iTijBghOKm/sxNDXUBl7CD6WMut0Q85wgN+Gc78"
        },
        "jetton1Transaction": {
            "chainId": "1100",
            "to": "0:f74345def726901e85075be154c7b5066f30a3386c8df01ed3e76fc20cff4ad4",
            "value": "320000000",
            "message": "te6ccsEBAgEAYgAAOQFrD4p+pQAAAAAJ8+J6MGSNKADvO5kConGyoByJOKUjz+JOcYR6rramIAAe1Ep3rA5wnBA/LlEDAQBN/Pnlj4AClYDlisUiRlr5snu9gkBGuLy568QE/pN3i1RO3LpEmwIDgzC5aA=="
        },
        "referenceId": "d731d01873364afda14b1f6041f8508d"
    }
}
```

{% endtab %}
{% endtabs %}

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

```json
{
    "dexId": "2300",
    "tokenA": "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA",
    "tokenB": "EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO",
    "amountADesired": "1100",
    "amountBDesired": "411858",
    "amountAMin": "1",
    "amountBMin": "1",
    "slippage": "1",
    "queryId": "166978170",
    "from": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "gas": "230000"
}
```

{% endtab %}

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

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "jetton0Transaction": {
            "chainId": "1100",
            "to": "0:73d110ca89db91fcb58feaa567a0448a8db0635a1c6076509dea8439c6d351be",
            "value": "320000000",
            "message": "te6ccsEBAgEAYQAAOAFpD4p+pQAAAAAJ8+J6IETIAO87mQKicbKgHIk4pSPP4k5xhHqutqYgAB7USnesDnCcED8uUQMBAE38+eWPgBD3JEg1TUr75iTijBghOKm/sxNDXUBl7CD6WMut0Q85wgN+Gc78"
        },
        "jetton1Transaction": {
            "chainId": "1100",
            "to": "0:f74345def726901e85075be154c7b5066f30a3386c8df01ed3e76fc20cff4ad4",
            "value": "320000000",
            "message": "te6ccsEBAgEAYgAAOQFrD4p+pQAAAAAJ8+J6MGSNKADvO5kConGyoByJOKUjz+JOcYR6rramIAAe1Ep3rA5wnBA/LlEDAQBN/Pnlj4AClYDlisUiRlr5snu9gkBGuLy568QE/pN3i1RO3LpEmwIDgzC5aA=="
        },
        "referenceId": "5274a75ef842459490e4fa496793fee5"
    }
}
```

{% endtab %}
{% endtabs %}

### /removeliquidity

Remove liquidity from a specified pool for a specified DEX.

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

#### Request Body

| Name                                        | Type   | Description                                                                                                                |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>     | String | Refer to the [DEX ID](https://docs.expand.network/integrations/dex-and-dex-aggregators/broken-reference) page for details. |
| tokenA<mark style="color:red;">\*</mark>    | String | Address of the first token being removed.                                                                                  |
| tokenB<mark style="color:red;">\*</mark>    | String | Address of the second token being removed.                                                                                 |
| liquidity<mark style="color:red;">\*</mark> | String | Total amount of liquidity to be removed from the given pool.                                                               |
| from<mark style="color:red;">\*</mark>      | String | Address of the sender of the token.                                                                                        |
| gas                                         | String | Maximum gas limit provided by the sender, for the transaction.                                                             |
| rpc                                         | String | Remote procedural call URL.                                                                                                |
| queryId                                     | String | The query id, used to identify your transaction.                                                                           |

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

```json
{
    "dexId": "2300",
    "tokenA": "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA",
    "tokenB": "EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO",
    "liquidity": "20",
    "queryId": "0",
    "from": "UQAxmMo2wxu_yQTySoV7u7-Con2csmcBloW0CrflBCQEr-7R",
    "gas": "230000"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1100",
        "to": "0:dbcb1554a8c4a09df5d1120e18b2286a1b23c75369d7a0f5d6e87b0878217b17",
        "value": "520000000",
        "message": "te6ccsEBAQEAMQAAAF1ZXwe8AAAAAAAAAAARSABjMZRthjd/kgnklQr3d38FRPs5ZM4DLQtoFW/KCEgJX2HFnx0=",
        "referenceId": "4c96461bb7864f6f900b43606c8aab1e"
    }
}
```

{% endtab %}
{% endtabs %}
