Core Candy Machine
Core Candy Machineの取得
Last updated March 10, 2026
Summary
fetchCandyMachine関数は、設定、Authority、ロードされたアイテムを含むCore Candy Machineの完全なオンチェーンアカウントデータを取得します。
- アイテム数、ミント済みアイテム数、ロードされたすべてのconfig lineエントリを含む完全なCandy Machineアカウント状態を返します
- Candy Machineの公開鍵と
mplCoreCandyMachineプラグインが設定されたUMIインスタンスのみが必要です - ガード設定は別のアカウントに保存されており、
safeFetchCandyGuardを使用して独立して取得する必要があります
Core Candy Machineアカウントデータの取得
fetchCandyMachine関数は、SolanaブロックチェーンからCandy Machineアカウント全体を読み取り、すべての設定フィールド、ロードされたアイテム、現在のミント進捗を含む型付きオブジェクトにデシリアライズします。
Core Candy Machineの取得
import { fetchCandyMachine, mplCandyMachine as mplCoreCandyMachine } from "@metaplex-foundation/mpl-core-candy-machine";
import { publicKey } from "@metaplex-foundation/umi";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
const mainnet = "https://api.mainnet-beta.solana.com"
const devnet = "https://api.devnet.solana.com"
const umi = createUmi(mainnet)
.use(mplCoreCandyMachine())
const candyMachineId = "11111111111111111111111111111111"
const candyMachine = await fetchCandyMachine( umi, publicKey(candyMachineId));
console.log({ candyMachine });
Notes
- 返されるオブジェクトには、ロードされたconfig lineアイテムの完全なリスト、アイテム数、ミント済みアイテム数、すべてのCandy Machine設定が含まれます。
- ガード設定は別のCandy Guardアカウントに保存されています。指定されたCandy Machineのガード設定を取得するには
safeFetchCandyGuardを使用してください。 - プレースホルダーの公開鍵(
11111111111111111111111111111111)を実際のCandy Machineアドレスに置き換えてください。 - メインネット使用時は、レート制限を避けるため、公開の
api.mainnet-beta.solana.comエンドポイントではなく専用のRPCプロバイダーの使用を検討してください。
