Skip to main content

useLazyMint

Hook for lazy minting a batch of NFTs on a drop contract.

Available to use on smart contracts that implement the LazyMintable interface, and follow either the ERC721 or ERC1155 standard.

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

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

Usage

Provide your drop contract (ERC721 or ERC1155) as the argument to the hook, and an array of metadata objects to lazy-mint.

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

const contractAddress = "{{contract_address}}";

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

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
lazyMint({
// Metadata of the NFTs to upload
metadatas: [
{
name: "My NFT",
description: "An example NFT",
image: "{{image_url}}",
},
],
})
}
>
Lazy Mint NFTs
</Web3Button>
);
}

Configuration

metadatas (required)

metadatas (required)

An array of objects containing the metadata of the NFTs to lazy mint.

Your metadata objects must follow the Metadata standards.

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

const contractAddress = "{{contract_address}}";

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

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
lazyMint({
// Metadata of the NFTs to upload
metadatas: [
{
name: "My NFT",
description: "An example NFT",
image: "{{image_url}}",
},
],
})
}
>
Lazy Mint NFTs
</Web3Button>
);
}