useLazyMint

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

Available to use on smart contracts that implement the "Drop" extension, and follow either the ERC721 or ERC1155 standard.

Example

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";
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>
);
}

Parameters

Returns

A mutation object to lazy mint a batch of NFTs

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

options

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

metadatas

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";
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>
);
}