> For the complete documentation index, see [llms.txt](https://barururu3-pororo-kmt.gitbook.io/ytendens-tools-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://barururu3-pororo-kmt.gitbook.io/ytendens-tools-doc/tools/collections-assets-owner-list.md).

# Collections Assets Owner List

## Collections Assets Owner List とは？

<https://open-sea-utilities.vercel.app/collections-assets-owner-list>

特定のコレクションのNFTを保有する人のアドレス、保有数などを一覧表示します。

あるコレクションのNFTを買ってくれた人に特典をプレゼントしたい！って時に使うとちょっと便利。

![](https://3762893677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsVZXYkJb49k7YAfINFN3%2Fuploads%2Fa1UvXKumDJvzCb5zR4tk%2Fimage.png?alt=media\&token=383a6836-d363-4f7a-b0f8-b7ace432c171)

※イメージ画像では[ak](https://twitter.com/ak_ism49)さんの「[Gothic Mysterious Girl's of Secret area](https://opensea.io/collection/ak-ism49)」を使わせてもらってます。

## 仕組み

Open Seaが提供するAPIを使用し、あるコレクションに含まれるNFTとそのオーナー情報を収集します。

#### ①コレクションに含まれるNFT情報の取得。

{% embed url="<https://docs.opensea.io/reference/getting-assets>" %}
コレクションに含まれるNFTのコントラクトアドレス、トークンIDをまとめて取得するためのAPI
{% endembed %}

| パラメータ      | 設定値                       |
| ---------- | ------------------------- |
| collection | 入力されたコレクションURLのslug\_name |
| limit      | 50                        |
| offset     | 50 \* API実行回数             |

まず初めに「Retrieving assets」APIを叩き、ユーザが入力したコレクションに含まれるNFTの情報を取得します。1回の実行で最大50件しか取得できないため、すべての情報を取りきるまで何度も当APIを叩きます。

#### ②NFTのオーナー情報の取得

{% embed url="<https://docs.opensea.io/reference/retrieving-a-single-asset>" %}
オーナー情報を取得するためのAPI
{% endembed %}

| パラメータ                    | 設定値                                |
| ------------------------ | ---------------------------------- |
| asset\_contract\_address | 「Retrieving assets」で取得したコントラクトアドレス |
| token\_id                | 「Retrieving assets」で取得したトークンID     |

①で取得したNFT情報を一件一件見ていき、コントラクトアドレス、トークンIDを使って「Retrieving a single asset」を叩きます。

オーナーのアドレス、そのオーナーがコレクションのNFTを何個保有しているか、保有しているNFTの名称などを収集し、一覧化して表示します。

## 注意事項

* Ethereumチェーンのみ対応。Polygonは非対応。
* NFTの数だけ当APIを実行するため、NFT数の多いコレクションほど時間が掛かります。発行数10000個のコレクションなんかは死ぬほど待たされます。（でも取得はできます。）
* 同一のコンテンツを複数枚発行しているタイプのNFTの場合、保有者の情報が10人分しか取得できません。（「Retrieving a single asset」の仕様） 保有者が11人以上いる場合は全員の情報を表示できませんのでご注意ください。

![こういうやつ](https://3762893677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsVZXYkJb49k7YAfINFN3%2Fuploads%2FLbp8ZcwJkmXipneI0Zyo%2F%E7%84%A1%E9%A1%8C.png?alt=media\&token=b323d5bb-4e00-4ddc-ba6c-eeab0aa812e0)
