Skip to main content

Mint Limit

info

A newer version of this page is available in the Developer Hub. Click here to read it.

Overview​

The Mint Limit guard allows specifying a limit on the number of NFTs each wallet can mint.

The limit is set per wallet, per candy machine and per identifier — provided in the settings — to allow multiple mint limits within the same Candy Machine.

CandyMachinesV3-GuardsMintLimit.png

Guard Settings​

The Mint Limit guard contains the following settings:

  • ID: A unique identifier for this guard. Different identifiers will use different counters to track how many items were minted by a given wallet. This is particularly useful when using groups of guards as we may want each of them to have a different mint limit.
  • Limit: The maximum number of mints allowed per wallet for that identifier.

JavaScript — Umi library (recommended)

Here’s how we can set up a Candy Machine using the Mint Limit guard.

create(umi, {
// ...
guards: {
mintLimit: some({ id: 1, limit: 5 }),
},
});

API References: create, MintLimit

JavaScript — SDK

Here’s how we can set up a Candy Machine using the Mint Limit guard via the JS SDK.

const { candyMachine } = await metaplex.candyMachines().create({
// ...
guards: {
mintLimit: {
id: 1,
limit: 5,
},
},
});

API References: Operation, Input, Output, Transaction Builder, Guard Settings.

Mint Settings​

The Mint Limit guard contains the following Mint Settings:

  • ID: A unique identifier for this guard.

Note that, if you’re planning on constructing instructions without the help of our SDKs, you will need to provide these Mint Settings and more as a combination of instruction arguments and remaining accounts. See the Candy Guard’s program documentation for more details.

JavaScript — Umi library (recommended)

You may pass the Mint Settings of the Mint Limit guard using the mintArgs argument like so.

mintV2(umi, {
// ...
mintArgs: {
mintLimit: some({ id: 1 }),
},
});

API References: mintV2, MintLimitMintArgs

JavaScript — SDK

The JS SDK does not require any Mint Settings for the Mint Limit guard since it can infer them from the provided Candy Machine model.

Route Instruction​

The Mint Limit guard does not support the route instruction.