Skip to main content

useDelayedRevealLazyMint

Hook for performing a delayed-reveal lazy minting.

Available to use on smart contracts that implement the Revealable interface.

import { useDelayedRevealLazyMint } from "@thirdweb-dev/react";

Usage

Provide your Revealable contract as the argument.

import { useDelayedRevealLazyMint, useContract, Web3Button } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { mutateAsync: mintNft, isLoading, error } = useDelayedRevealLazyMint(contract);

if (error) {
console.error("failed to mint nft", error);
}

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
mintNft({
placeholder: {
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
metadatas: [
// You can provide up to 1000 metadata objects
{
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
...
],
password: "{{password}}", // Password to be used for encryption
})
}
>
Mint NFTs
</Web3Button>
);
}

Configuration

placeholder

The placeholder object is used as a placeholder while the metadatas are being encrypted.

It will be replaced with the first metadata object in the metadatas array.

import { useDelayedRevealLazyMint, useContract, Web3Button } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { mutateAsync: mintNft, isLoading, error } = useDelayedRevealLazyMint(contract);

if (error) {
console.error("failed to mint nft", error);
}

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
mintNft({
placeholder: {
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
metadatas: [
// You can provide up to 1000 metadata objects
{
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
...
],
password: "{{password}}", // Password to be used for encryption
})
}
>
Mint NFTs
</Web3Button>
);
}

metadatas

An array of metadata objects up to 1000.

Each metadata object must conform to the standard metadata properties.

import { useDelayedRevealLazyMint, useContract, Web3Button } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { mutateAsync: mintNft, isLoading, error } = useDelayedRevealLazyMint(contract);

if (error) {
console.error("failed to mint nft", error);
}

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
mintNft({
placeholder: {
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
metadatas: [
// You can provide up to 1000 metadata objects
{
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
...
],
password: "{{password}}", // Password to be used for encryption
})
}
>
Mint NFTs
</Web3Button>
);
}

password

The password used to encrypt the metadatas.

import { useDelayedRevealLazyMint, useContract, Web3Button } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { mutateAsync: mintNft, isLoading, error } = useDelayedRevealLazyMint(contract);

if (error) {
console.error("failed to mint nft", error);
}

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
mintNft({
placeholder: {
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
metadatas: [
// You can provide up to 1000 metadata objects
{
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
...
],
password: "{{password}}", // Password to be used for encryption
})
}
>
Mint NFTs
</Web3Button>
);
}