useDelayedRevealLazyMint

Hook to lazy-mint a batch of NFTs with delayed reveal ; allowing the owner to set placeholder metadata and reveal the metadata of the NFTs at a later time.

Available to use on contracts that implement the ERC721Revealable or ERC1155Revealable interfaces.

Example

import {
useDelayedRevealLazyMint,
useContract,
Web3Button,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const {
mutateAsync: mintNft,
isLoading,
error,
} = useDelayedRevealLazyMint(contract);
const nftData = {
placeholder: {
name: "My NFT",
description: "This is my NFT",
image: "ipfs://example.com/my-nft.png", // Accepts any URL or File type
},
metadatas: [
{
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
};
return (
<Web3Button
contractAddress={contractAddress}
action={() => mintNft(nftData)}
>
Mint NFTs
</Web3Button>
);
}

Parameters

Returns

Mutation object to lazy mint a batch of NFTs

const { mutateAsync, isLoading, error } =
useDelayedRevealLazyMint(contract);

options

The mutation function takes an object as argument with below properties:

metadatas

An array of metadata objects, representing the metadata of the NFTs to be lazy-minted. Each metadata object must conform to the standard metadata properties .

password

The password used to encrypt the metadatas.

The password CANNOT be recovered once it is set. If you lose the password, you will not be able to reveal the metadata.