# DAO

## Mendapatkan data pemegang saham

<mark style="color:green;">`POST`</mark> `https://api.octusbridge.io/v1/dao/search/stakeholders`

{% tabs %}
{% tab title="200: OK Successful request" %}

```
{
  "stakeholders": [
    {
      "userAddress": "0:0a75c8fa5a9efa817eda3fcd51717d9690cc7ec989881fecb73616f249b8fbce",
      "votes": "0",
      "voteWeight": "0",
      "proposalVotesCount": 1
    },
    ...
{
      "userAddress": "0:8e17dbaa03a309b9f05867595126a72e5cbbe8c61d10f1250fb8d9753aaf0f7d",
      "votes": "0",
      "voteWeight": "0",
      "proposalVotesCount": 0
    }
  ],
  "totalCount": 206
}
```

{% endtab %}
{% endtabs %}

Fungsi ini digunakan untuk mendapatkan data pemegang saham.

Dapat digunakan untuk menampilkan daftar jumlah pemegang saham yang diinginkan, di mana informasi tentang jumlah total suara yang dikumpulkan oleh pemegang saham, berapa banyak suara pemegang saham yang dapat ditimbang, alamat dan jumlah pengajuan yang dia pilih diurutkan berdasarkan bobot suara.

### Parameter permintaan

Parameter tubuh yang diperlukan:

| Nama     | Nilai contoh          | Komentar                                                                                                                                                                                                               |
| -------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| limit    | `50`                  | Jumlah maksimum pemegang saham yang akan diambil                                                                                                                                                                       |
| offset   | `0`                   | Offset                                                                                                                                                                                                                 |
| ordering | `voteweightascending` | Nilai berdasarkan data pemegang saham yang diambil akan diurutkan (voteweightascending, voteweightdescending…)berdasarkan data pemegang saham yang diambil akan diurutkan (voteweightascending, voteweightdescending…) |

### Penjelasan bidang respons

| Nama               | Nilai contoh                                                         | Komentar                                                         |
| ------------------ | -------------------------------------------------------------------- | ---------------------------------------------------------------- |
| stakeholders       | -                                                                    | Daftar data pemegang saham ditentukan oleh parameter tubuh batas |
| proposalVotesCount | `1`                                                                  | Jumlah pengajuan pemegang saham mengangkat suara                 |
| userAddress        | `0:0c3fbf8b400ce637a49e09e7ae2fc5e92920680b1d10f4cd6956c7aebde93903` | Alamat pemegang saham                                            |
| voteWeight         | `0`                                                                  | Jumlah per suara                                                 |
| votes              | `0`                                                                  | Jumlah total suara yang terkumpul                                |
| totalCount         | `208`                                                                | Jumlah pemegang saham                                            |

### Contoh

```java
app.post('/dao/search/stakeholders', (req, res) => {
    axios({
        method: 'post',
        url: `${apiUrl}/dao/search/stakeholders`,
        data: {
            limit: req.body.limit,
            offset: req.body.offset,
            ordering: req.body.ordering
        }
      })
    .then(function (response) {
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
})
```

## Mendapatkan data pemegang saham

<mark style="color:blue;">`GET`</mark> `https://api.octusbridge.io/v1/dao/user/{user_address}`

{% tabs %}
{% tab title="200: OK Successful request" %}

```python
{
  "userAddress": "0:66003d2db4bc1566c3d7d3c118004b1e1d54f1f62c30c6b173845db3aa459f07",
  "votes": "100002.580351726000",
  "voteWeight": "3.4000",
  "proposalVotesCount": 1
}
```

{% endtab %}
{% endtabs %}

Fungsi ini digunakan untuk mendapatkan data pemegang saham.

Dapat digunakan untuk menampilkan data pemegang saham seseorang berdasarkan alamat akunnya. Informasi yang dapat ditampilkan adalah jumlah suara yang diajukan oleh pemegang saham tertentu, bobot suaranya, alamat dan jumlah total suara pengajuan.

### Parameter permintaan

Parameter yang diperlukan:

| Nama        | Nilai Contoh                                                       | Komentar             |
| ----------- | ------------------------------------------------------------------ | -------------------- |
| userAddress | 0:66003d2db4bc1566c3d7d3c118004b1e1d54f1f62c30c6b173845db3aa459f07 | Alamat akun tertentu |

### Penjelasan bidang respons

| Nama               | Nilai contoh                                                       | Komentar                                         |
| ------------------ | ------------------------------------------------------------------ | ------------------------------------------------ |
| proposalVotesCount | 1                                                                  | Jumlah pengajuan pemegang saham mengangkat suara |
| userAddress        | 0:66003d2db4bc1566c3d7d3c118004b1e1d54f1f62c30c6b173845db3aa459f07 | Alamat pengguna                                  |
| voteWeight         | 3.400                                                              | Jumlah yang mewakili bobot suara (per suara)     |
| votes              | 100002.580351726000                                                | Jumlah total suara yang terkumpul                |

### Contoh

```java
app.get('/dao/user/:user_address', (req, res) => {
    axios({
        method: 'get',
        url: `${apiUrl}/dao/user/${req.params.user_address}`
      })
    .then(function (response) {
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
})
```


---

# 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.octusbridge.io/ob-id/integrate/octus-bridge-api/bridge-api/dao.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.
