機能
Core Collectionの取得
Last updated April 8, 2026
fetchCollectionはアドレスでSolanaからCore Collectionアカウントを取得し、型付きオブジェクトにデシリアライズします。
Summary
fetchCollectionはCollectionアカウントを読み取り、名前、URI、Update Authority、プラグインデータ、メンバー数などすべてのオンチェーンフィールドを返します。
- Collectionの公開鍵が必要です
- すべてのオンチェーンフィールドを持つ型付き
Collectionオブジェクトを返します - アドレスが有効なCollectionアカウントでない場合はエラーをスローします
アドレスによるCollectionの取得
CollectionのPublic KeyをfetchCollectionに渡してアカウントを取得します。
Core Collectionの取得
fetch-collection.ts
import { fetchCollection } from '@metaplex-foundation/mpl-core'
import { publicKey } from '@metaplex-foundation/umi'
const collectionId = publicKey('11111111111111111111111111111111')
const collection = await fetchCollection(umi, collectionId)
console.log(collection)
Notes
- アドレスが存在しないか、Core Collectionアカウントでない場合、
fetchCollectionはエラーをスローします currentSizeはコレクション内の現在のAsset数を反映し、numMintedは累計総数です- 書き込み操作後に状態を確認するには、
sendAndConfirmの後にfetchCollectionを呼び出してください
Quick Reference
| 項目 | 値 |
|---|---|
| JS関数 | fetchCollection |
| 必須引数 | CollectionのPublic Key |
| 戻り値 | Collectionオブジェクト |
| ソース | GitHub |
