기능

Core Collection 조회

Last updated April 8, 2026

fetchCollection은 주소로 Solana에서 Core Collection 계정을 조회하고 타입이 지정된 객체로 역직렬화합니다.

Summary

fetchCollection은 Collection 계정을 읽고 이름, URI, Update Authority, 플러그인 데이터, 멤버 수 등 모든 온체인 필드를 반환합니다.

  • 컬렉션의 공개 키가 필요합니다
  • 모든 온체인 필드를 가진 타입이 지정된 Collection 객체를 반환합니다
  • 주소가 유효한 Collection 계정이 아닌 경우 오류를 발생시킵니다

주소로 Collection 조회

Collection의 공개 키를 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 공개 키
반환값Collection 객체
소스GitHub