# Pot

{% hint style="info" %}
For query parameter `chain` see supported chains [here](/docs/using-lotto-sdk/for-developers/api-docs.md#supported-chains)
{% endhint %}

## Get current pot info

## Info about the current pot

<mark style="color:blue;">`GET`</mark> `https://api.rpslabs/v1/pot/info`

Returns current pot ID, size, limit and ticket number

#### Query Parameters

| Name                                    | Type   | Description                          |
| --------------------------------------- | ------ | ------------------------------------ |
| chain<mark style="color:red;">\*</mark> | String | Blockchain hosting the raffle contra |

#### Headers

| Name                                            | Type | Description |
| ----------------------------------------------- | ---- | ----------- |
| Authorization<mark style="color:red;">\*</mark> |      | API Key     |

{% tabs %}
{% tab title="200: OK Success" %}

```json
{
    "pot_id": 4
    "pot_limit": "1000000000000000000",
    "pot_size": "132207300000000000",
    "tickets_issued": 7
    "tickets_remaining": 13 
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```json
{
    "message": "INTERNAL_SERVER_ERROR",
    "code": 500
}
```

{% endtab %}

{% tab title="400: Bad Request Incorrect Chain" %}

```json
{
    "message": "INCORRECT_CHAIN",
    "code": 400
}
```

{% endtab %}
{% endtabs %}

## Get previous winners

## All previous winners in the raffle

<mark style="color:blue;">`GET`</mark> `https://api.rpslabs/v1/pot/winners`

Returns all users that won the raffle in the past and info related to their pots

#### Query Parameters

| Name                                    | Type   | Description                          |
| --------------------------------------- | ------ | ------------------------------------ |
| chain<mark style="color:red;">\*</mark> | String | Blockchain hosting the raffle contra |

#### Headers

| Name                                            | Type | Description |
| ----------------------------------------------- | ---- | ----------- |
| Authorization<mark style="color:red;">\*</mark> |      | API Key     |

{% tabs %}
{% tab title="200: OK Success" %}

```json
[
    {
        "wallet_address": "0xcb1ff71fc73b5cf332f8daae36385a4d0ff7c5cb",
        "ticket_id": 3,
        "pot_id": 1,
        "pot_size": "1000000000000000000",
        "tx_hash": "0x01a3830491c564386cd2da2d7a5bce1198a8d5d2f97b9675ca64a1ed30028010",
        "vrf_tx_hash": "0x8052d61d01c39795012e21a91bc389b100d7df89a38014fb94a401686614eb70",
        "raffle_timestamp": "2023-10-13T14:07:09.029933Z"
    },
    {
        "wallet_address": "0xcb1ff71fc73b5cf332f8daae36385a4d0ff7c5cb",
        "ticket_id": 9,
        "pot_id": 2,
        "pot_size": "1000000000000000000",
        "tx_hash": "0xabb3ae985c85e11739a12a82c4a8130d90df4d163afe1cd663325c95c8d167b5",
        "vrf_tx_hash": "0xb469ec74634826d5edfe264c374494b5fcb951739919c18619a45c691733cdb1",
        "raffle_timestamp": "2023-10-13T14:07:12.873203Z"
    },
    {
        "wallet_address": "0x10082530b5c9585c5144d71556d12195026ea75c",
        "ticket_id": 1391,
        "pot_id": 3,
        "pot_size": "1000000000000000000",
        "tx_hash": "0xc72883ce37200e61649a9a8caf6ec2ae6b4962ae6305ab7a786b757ab89b6907",
        "vrf_tx_hash": "0x43944178da987395eca9d0b1bd3e31ac5c9c68b17f9da9e7f8aca8e3018c17a5",
        "raffle_timestamp": "2023-10-13T14:08:43.082094Z"
    }
]
```

{% endtab %}

{% tab title="400: Bad Request Incorrect Chain" %}

```json
{
    "message": "INCORRECT_CHAIN",
    "code": 400
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```json
{
    "message": "INTERNAL_SERVER_ERROR",
    "code": 500
}
```

{% endtab %}
{% endtabs %}

## Get pot leaderboard

## All contestants of a pot

<mark style="color:blue;">`GET`</mark> `https://api.rpslabs/v1/pot/{pot_id}/leaderboard`

Returns all wallet addresses in a certain pot sorted by their number of tickets

#### Query Parameters

| Name                                    | Type   | Description                            |
| --------------------------------------- | ------ | -------------------------------------- |
| chain<mark style="color:red;">\*</mark> | String | Blockchain hosting the raffle contract |

#### Headers

| Name                                            | Type | Description |
| ----------------------------------------------- | ---- | ----------- |
| Authorization<mark style="color:red;">\*</mark> |      | API Key     |

{% tabs %}
{% tab title="400: Bad Request Incorrect Body" %}

```json
{
    "message": "INCORRECT_BODY",
    "code": 400
}
```

{% endtab %}

{% tab title="200: OK Success" %}

```json
[
    {
        "num_of_tickets": 289,
        "wallet_address": "0x56d3f3a73c48391f413e1d9353165fdb0c7dda3c",
        "pot_id": 3
    },
    {
        "num_of_tickets": 176,
        "wallet_address": "0xcb1ff71fc73b5cf332f8daae36385a4d0ff7c5cb",
        "pot_id": 3
    },
    {
        "num_of_tickets": 108,
        "wallet_address": "0xed77823c382b7f48adffebbb30a77f461d0e3d6b",
        "pot_id": 3
    },
    {
        "num_of_tickets": 11,
        "wallet_address": "0xa22fe8d7b230a48de511669fefa957bdc97f2705",
        "pot_id": 3
    },
    {
        "num_of_tickets": 2,
        "wallet_address": "0xda682e8a4e42885eddd5aa3c20bf1b3926ae0a79",
        "pot_id": 3
    }
]
```

{% endtab %}

{% tab title="400: Bad Request Incorrect Chain" %}

```json
{
    "message": "INCORRECT_CHAIN",
    "code": 400
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```json
{
    "message": "INTERNAL_SERVER_ERROR",
    "code": 500
}
```

{% endtab %}
{% endtabs %}

## Get last day pot leaderboard

## Contestants of the current pot that earned tickets in the last 24 hours

<mark style="color:blue;">`GET`</mark> `https://api.rpslabs/v1/pot/current/leaderboard/last`

Returns all wallet addresses that received tickets for the current pot in the last 24 hours, sorted by that number of tickets

#### Query Parameters

| Name                                    | Type   | Description                            |
| --------------------------------------- | ------ | -------------------------------------- |
| chain<mark style="color:red;">\*</mark> | String | Blockchain hosting the raffle contract |

#### Headers

| Name                                            | Type | Description |
| ----------------------------------------------- | ---- | ----------- |
| Authorization<mark style="color:red;">\*</mark> |      | API Key     |

{% tabs %}
{% tab title="200: OK Success" %}

```json
[
    {
        "num_of_tickets": 153,
        "wallet_address": "0x56d3f3a73c48391f413e1d9353165fdb0c7dda3c",
        "pot_id": 3
    },
    {
        "num_of_tickets": 88,
        "wallet_address": "0xcb1ff71fc73b5cf332f8daae36385a4d0ff7c5cb",
        "pot_id": 3
    },
    {
        "num_of_tickets": 80,
        "wallet_address": "0xed77823c382b7f48adffebbb30a77f461d0e3d6b",
        "pot_id": 3
    },
    {
        "num_of_tickets": 11,
        "wallet_address": "0xa22fe8d7b230a48de511669fefa957bdc97f2705",
        "pot_id": 3
    }
]
```

{% endtab %}

{% tab title="400: Bad Request Incorrect Chain" %}

```json
{
    "message": "INCORRECT_CHAIN",
    "code": 400
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Server Error" %}

```json
{
    "message": "INTERNAL_SERVER_ERROR",
    "code": 500
}
```

{% 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://rpslabs.gitbook.io/docs/using-lotto-sdk/for-developers/api-docs/pot.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.
