# Sologenic

### Supported Chains

Available on **XRPL Mainnet and Testnet**

### 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 Sologenic.
* [<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;">**/**</mark>](#swap)[<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;">**/**</mark>](#swap)[<mark style="color:blue;">**removeliquidity**</mark>](#removeliquidity)<mark style="color:green;">`POST`</mark> - Remove liquidity from a specified pool for a specified DEX.

### DEX IDs

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

Below is a list of DEX IDs related to Sologenic. For a complete list and more information, please see the [DEX ID](https://docs.expand.network/ids/dex-ids) page.

| DEX Name  | Chain        | DEX ID |
| --------- | ------------ | ------ |
| Sologenic | XRPL Mainnet | 3500   |
| Sologenic | XRPL Testnet | 3501   |

## Endpoint Details

### /getprice

Returns the swap quotation for a given token pair.

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

#### Query Parameter

| 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. |
| amountIn<mark style="color:red;">\*</mark> | String | Amount of token.                                                                 |
| path<mark style="color:red;">\*</mark>     | String | Comma separated values of token addresses whose price is to be fetched.          |

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

```url
https://api.expand.network/dex/getprice?path=PHNIX%3ArDFXbW2ZZCG5WgPtqwNiA2xZokLMm9ivmN,XRP&amountIn=10000000000000000000&dexId=3500
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "amountIn": "10000000000000000000",
    "path": [
      "PHNIX:rDFXbW2ZZCG5WgPtqwNiA2xZokLMm9ivmN",
      "XRP"
    ],
    "amountsOut": [
      "10000000000000000000",
      "50600"
    ]
  }
}
```

{% 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 Parameter

| 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. |
| address<mark style="color:red;">\*</mark>     | String | Public address of liquidity provider.                                            |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose liquidity is to be fetched.                                   |

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

```url
https://api.expand.network/dex/getuserliquidity?dexId=3500&poolAddress=rakZprdzwsUJ1rD2ouhYYAVP7tPbhrCbtz&address=rfkgjHxPbq1z6i8boURnEXY4qe4JFbiFLQ
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "pairAddress": "rakZprdzwsUJ1rD2ouhYYAVP7tPbhrCbtz",
    "liquidity": "133406"
  }
}
```

{% endtab %}
{% endtabs %}

### /getpoolliquidity

Returns the total liquidity for a specified pool.

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

#### Query Parameter

| 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. |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose liquidity is to be fetched.                                   |

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

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

{% endtab %}

{% tab title="Sample Response" %}

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

{% 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 Parameter

| 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. |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose liquidity is to be fetched.                                   |

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

```url
https://api.expand.network/dex/gettokenliquidity?dexId=3500&poolAddress=rLjUKpwUVmz3vCTmFkXungxwzdoyrWRsFG
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "XRP": "3834555737847",
    "CRYPTO": "301396241674017700000"
  }
}
```

{% 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                                                                           |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------------------- |
| 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.                                            |
| amountIn<mark style="color:red;">\*</mark> | String | Amount of token to be swapped.                                                        |
| amountOutMin                               | String | Minimum amount accepted as a result of swap.                                          |
| from<mark style="color:red;">\*</mark>     | String | Address of the sender of the token.                                                   |
| slippage                                   | String | <p>Percentage of total swap value. By default, 1.</p><p>0 <= slippage value <= 10</p> |

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

```json
{
    "path": [
        "XRP",
        "SOLO:rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz"
    ],
    "amountIn": "20000",
    "amountOutMin": "2324",
    "from": "rfkgjHxPbq1z6i8boURnEXY4qe4JFbiFLQ",
    "dexId": "3500"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1600",
    "from": "rfkgjHxPbq1z6i8boURnEXY4qe4JFbiFLQ",
    "gas": "12",
    "data": "eyJUcmFuc2FjdGlvblR5cGUiOiJPZmZlckNyZWF0ZSIsIkFjY291bnQiOiJyZmtnakh4UGJxMXo2aThib1VSbkVYWTRxZTRKRmJpRkxRIiwiVGFrZXJQYXlzIjp7ImN1cnJlbmN5IjoiNTM0RjRDNEYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsImlzc3VlciI6InJzb0xvMlMxa2lHZUNjbjZoQ1VYVnJDcEdNV0xyUnJMWnoiLCJ2YWx1ZSI6IjIuMzI0ZS0xMiJ9LCJGbGFncyI6NjU1MzYwLCJUYWtlckdldHMiOiIyMDAwMCIsIkZlZSI6IjEyIiwiU2VxdWVuY2UiOjU4Mjc0MDc3LCJMYXN0TGVkZ2VyU2VxdWVuY2UiOjk0MzQ0MDMwfQ==",
    "referenceId": "6e9a1fbc246846698821985ce7fe43ab"
  }
}
```

{% 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                                                                           |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------- |
| 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.                                            |
| amountIn<mark style="color:red;">\*</mark>     | String | Amount of token0 and token1 to be added.                                              |
| slippage                                       | String | <p>Percentage of total swap value. By default, 1.</p><p>0 <= slippage value <= 10</p> |
| from<mark style="color:red;">\*</mark>         | String | Address of the sender of the token.                                                   |
| amountOutMin<mark style="color:red;">\*</mark> | String | Minimum amount accepted as a result of add liquidity.                                 |

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

```json
{
    "dexId": "3500",
    "amountIn": [
        "1000000",
        "1000000"
    ],
    "from": "rPJ2kXNTseFAD1qotRXBtv7cd3x8ZN4BkP",
    "path": [
        "XRP",
        "SOLO:rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz"
    ],
    "slippage": "10",
    "amountOutMin": "3"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1600",
    "from": "rPJ2kXNTseFAD1qotRXBtv7cd3x8ZN4BkP",
    "gas": "12",
    "data": "eyJBY2NvdW50IjoiclBKMmtYTlRzZUZBRDFxb3RSWEJ0djdjZDN4OFpONEJrUCIsIkFtb3VudCI6IjEwMDAwMDAiLCJBbW91bnQyIjp7ImN1cnJlbmN5IjoiNTM0RjRDNEYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsImlzc3VlciI6InJzb0xvMlMxa2lHZUNjbjZoQ1VYVnJDcEdNV0xyUnJMWnoiLCJ2YWx1ZSI6IjFlLTkifSwiQXNzZXQiOnsiY3VycmVuY3kiOiJYUlAifSwiQXNzZXQyIjp7ImN1cnJlbmN5IjoiNTM0RjRDNEYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsImlzc3VlciI6InJzb0xvMlMxa2lHZUNjbjZoQ1VYVnJDcEdNV0xyUnJMWnoifSwiRmxhZ3MiOjEwNDg1NzYsIkxQVG9rZW5PdXQiOnsiY3VycmVuY3kiOiIwMzQzMTc4MDFCMDg1MDA0NDZCQzUzM0I3MTgzNTlCQzAxNEQ2QjM3IiwiaXNzdWVyIjoick1FSm85SDVYdlRlMTdVb0FKemo4anRLVnZUUmN4d25nbyIsInZhbHVlIjoiMi43In0sIlRyYW5zYWN0aW9uVHlwZSI6IkFNTURlcG9zaXQiLCJGZWUiOiIxMiIsIlNlcXVlbmNlIjo4ODE3MjQ4NSwiTGFzdExlZGdlclNlcXVlbmNlIjo5NDM0NDA0M30=",
    "referenceId": "18fddf710a5b4ebbac7c322387fe6a4a"
  }
}
```

{% 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                                                                      |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| 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.                                       |
| from<mark style="color:red;">\*</mark>      | String | Address of the sender of the token.                                              |
| liquidity<mark style="color:red;">\*</mark> | String | The liquidity to be removed.                                                     |

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

```json
{
    "dexId": "3500",
    "liquidity": "1000000",
    "from": "rfkgjHxPbq1z6i8boURnEXY4qe4JFbiFLQ",
    "path": [
        "XRP",
        "SOLO:rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz"
    ]
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1600",
    "from": "rfkgjHxPbq1z6i8boURnEXY4qe4JFbiFLQ",
    "gas": "12",
    "data": "eyJBY2NvdW50IjoicmZrZ2pIeFBicTF6Nmk4Ym9VUm5FWFk0cWU0SkZiaUZMUSIsIkxQVG9rZW5JbiI6eyJjdXJyZW5jeSI6IjAzNDMxNzgwMUIwODUwMDQ0NkJDNTMzQjcxODM1OUJDMDE0RDZCMzciLCJpc3N1ZXIiOiJyTUVKbzlINVh2VGUxN1VvQUp6ajhqdEtWdlRSY3h3bmdvIiwidmFsdWUiOiIxMDAwMDAwIn0sIkFzc2V0Ijp7ImN1cnJlbmN5IjoiWFJQIn0sIkFzc2V0MiI6eyJjdXJyZW5jeSI6IjUzNEY0QzRGMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJpc3N1ZXIiOiJyc29MbzJTMWtpR2VDY242aENVWFZyQ3BHTVdMclJyTFp6In0sIkZsYWdzIjo2NTUzNiwiVHJhbnNhY3Rpb25UeXBlIjoiQU1NV2l0aGRyYXciLCJGZWUiOiIxMiIsIlNlcXVlbmNlIjo1ODI3NDA3NywiTGFzdExlZGdlclNlcXVlbmNlIjo5NDM0NDA1NH0=",
    "referenceId": "57d5293a14be48369d05fbcd44e718a0"
  }
}
```

{% endtab %}
{% endtabs %}
