ERC721 - Lazy Mint & Claim NFTs
You can utilize these features of the SDK on your contract if it implements LazyMint.
Batch Lazy-Mint NFTs
Batch upload NFT metadata to be lazy-minted to the contract.
You can provide metadata objects to have them uploaded and pinned to IPFS, or provide your own URLs.
- React
- Javascript
- Python
- Go
- Unity
const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: lazyMint,
isLoading,
error,
} = useLazyMint(contract);
if (error) {
console.error("failed to lazy mint NFT", error);
}
return (
<button
disabled={isLoading}
onClick={() => lazyMint({ metadatas: [{ name: "My NFT!"}] })}
>
Lazy mint NFT!
</button>
);
};
This snippet is for v3 of the SDK. Learn how to upgrade.
View in React SDK Documentation// Custom metadata of the NFTs to create
const metadatas = [{
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}, {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"),
}];
const results = await contract.erc721.lazyMint(metadatas); // uploads and creates the NFTs on chain
const firstTokenId = results[0].id; // token id of the first created NFT
const firstNFT = await results[0].data(); // (optional) fetch details of the first created NFT
This snippet is for v3 of the SDK. Learn how to upgrade.
View in Javascript SDK DocumentationThis feature is missing a code snippet or might not be supported yet.
Check the Python SDK documentation for more information.
Reach out on Discord for further assistance!
View Python SDK DocumentationThis feature is missing a code snippet or might not be supported yet.
Check the Go SDK documentation for more information.
Reach out on Discord for further assistance!
View Go SDK Documentation// Lazy minting in Unity is coming soon. Reach out to us in Discord if you need this feature!