Readonly
metaplexYou may use the builders()
client to access the
underlying Transaction Builders of this module.
const buildersClient = metaplex.candyMachinesV2().builders();
Creates a brand new Candy Machine.
const { candyMachine } = await metaplex
.candyMachinesV2()
.create({
sellerFeeBasisPoints: 500, // 5% royalties
price: sol(1.3), // 1.3 SOL
itemsAvailable: toBigNumber(1000), // 1000 items available
};
Optional
options: OperationOptionsDeletes an existing Candy Machine.
await metaplex.candyMachinesV2().delete({ candyMachine });
Optional
options: OperationOptionsFind all Candy Machines matching by a given publicKey
or a given type
.
The following two types are supported.
authority
: Find Candy Machines whose authority is the given publicKey
.
const someAuthority = new PublicKey('...');
const candyMachines = await metaplex
.candyMachinesV2()
.findAllBy({ type: 'authority', someAuthority });
wallet
: Find Candy Machines whose wallet address is the given publicKey
.
const someWallet = new PublicKey('...');
const candyMachines = await metaplex
.candyMachinesV2()
.findAllBy({ type: 'wallet', someWallet });
Optional
options: OperationOptionsFind an existing Candy Machine by its address.
const candyMachine = await metaplex.candyMachinesV2().findbyAddress({ address });
Optional
options: OperationOptionsFind all minted NFTs from a given Candy Machine address.
const nfts = await metaplex
.candyMachinesV2()
.findMintedNfts({ candyMachine };
Optional
options: OperationOptionsInsert items into an existing Candy Machine.
await metaplex
.candyMachines()
.insertItems({
candyMachine,
items: [
{ name: 'My NFT #1', uri: 'https://example.com/nft1' },
{ name: 'My NFT #2', uri: 'https://example.com/nft2' },
{ name: 'My NFT #3', uri: 'https://example.com/nft3' },
],
};
Optional
options: OperationOptionsMint an NFT from an existing Candy Machine.
const { nft } = await metaplex
.candyMachinesV2()
.mint({ candyMachine };
Optional
options: OperationOptionsHelper method that refetches a given Candy Machine.
const candyMachine = await metaplex.candyMachinesV2().refresh(candyMachine);
Optional
options: OperationOptionsUpdates an existing Candy Machine.
await metaplex
.candyMachinesV2()
.update({
candyMachine,
price: sol(2), // Updates the price only.
};
Optional
options: OperationOptionsGenerated using TypeDoc
This is a client for the Candy Machine module.
It enables us to interact with the Candy Machine program in order to create, update and delete Candy Machines as well as mint from them.
You may access this client via the
candyMachinesV2()
method of yourMetaplex
instance.Example
You can create a new Candy Machine with minimum input like so. By default, the current identity of the Metaplex instance will be the authority of the Candy Machine.
See
CandyMachine The
CandyMachine
model