Skip to main content

useBatchesToReveal

Hook for fetching batches of lazy-minted NFTs that were set to be revealed at a later date, but have not yet been revealed.

Available for contracts that implement the Delayed reveal interface, such as the NFT Drop.

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

Usage

Provide your NFT collection smart contract as the argument.

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

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

function App() {
// Contract must implement the Delayed reveal interface.
const { contract } = useContract(contractAddress);
const { data: batches, isLoading, error } = useBatchesToReveal(contract);

if (isLoading) {
return <div>Loading...</div>;
}

if (error) {
console.error("failed to fetch batches to reveal", error);
}

if (!batches) {
return <div>No batches to reveal</div>;
}

return <div>Batches to reveal: {batches.length}</div>;
}

Return Value

The hook's data property, once loaded, contains an array of batches that need to be revealed.

Each batch is an object with the following properties:

{
batchId: BigNumber;
batchUri: string;
placeholderMetadata: NFTMetadata;
}