Skip to main content

Redeemed Amount

Overview

The Redeemed Amount guard forbids minting when the number of minted NFTs for the entire Candy Machine reaches the configured maximum amount.

This guard becomes more interesting when used with Guard Groups since it allows us to add global minting thresholds to our groups.

CandyMachinesV3-GuardsRedeemedAmount.png

Guard Settings

The Redeemed Amount guard contains the following settings:

  • Maximum: The maximum amount of NFTs that can be minted.

JavaScript — Umi library (recommended)

Here’s how we can set up a Candy Machine using the Redeemed Amount guard.

create(umi, {
// ...
itemsAvailable: 500,
guards: {
redeemedAmount: some({ maximum: 300 }),
},
});

Notice that, even if the Candy Machine contains 500 items, only 300 of these items will be mintable because of this guard.

Thus, this guard becomes more useful when using Guard Groups. Here’s another example using two groups such that the first 300 NFTs can be minted for 1 SOL but the last 200 will need 2 SOL to mint.

create(umi, {
// ...
itemsAvailable: 500,
groups: [
{
label: "early",
guards: {
redeemedAmount: some({ maximum: 300 }),
solPayment: some({ lamports: sol(1), destination: treasury }),
},
},
{
label: "late",
guards: {
solPayment: some({ lamports: sol(2), destination: treasury }),
},
},
],
});

API References: create, RedeemedAmount

JavaScript — SDK

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

import { toBigNumber } from "@metaplex-foundation/js";

const { candyMachine } = await metaplex.candyMachines().create({
// ...
itemsAvailable: toBigNumber(500),
guards: {
redeemedAmount: {
maximum: toBigNumber(300),
},
},
});

Notice that, even if the Candy Machine contains 500 items, only 300 of these items will be mintable because of this guard.

Thus, this guard becomes more useful when using Guard Groups. Here’s another example using two groups such that the first 300 NFTs can be minted for 1 SOL but the last 200 will need 2 SOL to mint.

import { toBigNumber } from "@metaplex-foundation/js";

const { candyMachine } = await metaplex.candyMachines().create({
// ...
itemsAvailable: toBigNumber(500),
groups: [
{
label: "early",
guards: {
redeemedAmount: { maximum: toBigNumber(300) },
solPayment: { amount: sol(1), destination: treasury },
},
},
{
label: "late",
guards: {
solPayment: { amount: sol(2), destination: treasury },
},
},
],
});

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

Mint Settings

The Redeemed Amount guard does not need Mint Settings.

Route Instruction

The Redeemed Amount guard does not support the route instruction.