Protected
Readonly
metaplexCalls the special "route" instruction on a specific guard.
This allows guards to provide additional features such as creating PDAs that verify a payer before the mint instruction is executed or freezing and thawing minted NFTs.
The "route" instruction must select a specific guard on a specific group (if groups are enabled) since it is possible for the same type of guard to have different settings based on its group.
Additionally, it is possible for a guard to support multiple "paths" within
their "route" instruction. The route settings of the guard will usually use
the path
property to distinguish them.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.callGuardRoute({
candyMachine,
guard: 'allowList',
settings: {
path: 'proof',
merkleProof: getMerkleProof(data, leaf)
},
});
Optional
options: TransactionBuilderOptionsCreates a brand new Candy Machine with the provided settings.
Unless the withoutCandyGuard
option is set to true
, a
Candy Guard will be created with the given guards and
immediately linked to the Candy Machine.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.create({
itemsAvailable: toBigNumber(5000),
sellerFeeBasisPoints: 333, // 3.33%
collection: {
address: collectionNft.address,
updateAuthority: collectionUpdateAuthority,
},
});
Optional
options: TransactionBuilderOptionsCreates a new Candy Guard account with the provided settings.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.createCandyGuard({
guards: {
startDate: { date: toDateTime('2022-09-05T20:00:00.000Z') },
solPayment: { amount: sol(1.5), },
botTax: { lamports: sol(0.01), lastInstruction: true },
},
});
Optional
options: TransactionBuilderOptionsDeletes a Candy Machine account by withdrawing its rent-exempt balance.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.delete({
candyMachine: candyMachine.address,
candyGuard: candyMachine.candyGuard.address,
authority,
});
Optional
options: TransactionBuilderOptionsDeletes a Candy Guard account by withdrawing its rent-exempt balance.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.deleteCandyGuard({
candyGuard,
authority,
});
Optional
options: TransactionBuilderOptionsInsert items into an existing Candy Machine.
Note that the name and URI of each item should not include the prefixes configured in the config line settings.
const transactionBuilder = metaplex
.candyMachines()
.builders()
.insertItems({ candyMachine, items });
Optional
options: TransactionBuilderOptionsMints the next NFT from a given candy machine.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.mint({
candyMachine,
collectionUpdateAuthority,
});
Optional
options: TransactionBuilderOptionsUnwraps the given Candy Machine from its Candy Guard.
This makes the Candy Machine authority its own mint authority again
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.unwrapCandyGuard({
candyMachine,
candyGuard,
});
Optional
options: TransactionBuilderOptionsUpdates the every aspect of an existing Candy Machine, including its authorities, collection and guards (when associated with a Candy Guard).
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.update({
candyMachine,
sellerFeeBasisPoints: 500,
});
Optional
options: TransactionBuilderOptionsUpdates an existing Candy Guard account.
Note that the provided guards
and groups
will replace the existing ones.
const transactionBuilder = metaplex
.candyMachines()
.builders()
.updateCandyGuard({
candyGuard: candyGuard.address,
guards: {
startDate: { date: toDateTime('2022-09-05T20:00:00.000Z') },
solPayment: { amount: sol(1.5), },
botTax: { lamports: sol(0.01), lastInstruction: true },
},
groups: [],
});
Optional
options: TransactionBuilderOptions{@inheritDoc updateCandyGuardAuthorityBuilder}
Optional
options: TransactionBuilderOptionsWraps the given Candy Machine in a Candy Guard.
This makes the Candy Guard the mint authority for the Candy Machine which means all minting will have to go through the Candy Guard.
const transactionBuilder = await metaplex
.candyMachines()
.builders()
.wrapCandyGuard({
candyMachine,
candyGuard,
});
Optional
options: TransactionBuilderOptionsGenerated using TypeDoc
This client allows you to access the underlying Transaction Builders for the write operations of the Candy Guard module.
See
CandyMachineClient