Actions

Fetching a Core Candy Machine

You can fetch a Core Candy Machine and its data using the fetchCandyMachine() function. The response will contain the following arguments:

NameTypeDescription
authorityPublicKeyThe key responsible for updating the Candy Machine's data.
mintAuthorityPublicKeyThe key responsible for minting NFTs from the Candy Machine.
collectionMintPublicKeyThe address of the NFT collection associated with the Candy Machine.
itemsRedeemedbigintThe number of items successfully minted from the Candy Machine.
dataCandyMachineDataContains the Candy Machine's configuration and settings.
itemsCandyMachineItem[]Represents items available for minting in the Candy Machine.
itemsLoadednumberThe total number of items currently loaded into the Candy Machine.
isMutablebooleanIndicates whether assets created by the Candy Machine can be modified after creation.

And this are the CandyMachineData and CandyMachineItem types:

Here is an example of how to fetch a Core Candy Machine directly:

Fetch a Core Candy Machine

import { fetchCandyMachine, mplCandyMachine } from "@metaplex-foundation/mpl-core-candy-machine";
import { publicKey } from "@metaplex-foundation/umi";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";

const umi = createUmi("https://api.devnet.solana.com").use(mplCandyMachine())

const candyMachineId = "11111111111111111111111111111111"

const candyMachine = await fetchCandyMachine( umi, publicKey(candyMachineId));
Previous
Withdrawing a Candy Machine