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:
Name | Type | Description |
---|---|---|
authority | PublicKey | The key responsible for updating the Candy Machine's data. |
mintAuthority | PublicKey | The key responsible for minting NFTs from the Candy Machine. |
collectionMint | PublicKey | The address of the NFT collection associated with the Candy Machine. |
itemsRedeemed | bigint | The number of items successfully minted from the Candy Machine. |
data | CandyMachineData | Contains the Candy Machine's configuration and settings. |
items | CandyMachineItem[] | Represents items available for minting in the Candy Machine. |
itemsLoaded | number | The total number of items currently loaded into the Candy Machine. |
isMutable | boolean | Indicates 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));