Skip to main content

DelayedReveal.createDelayedRevealBatch() method

Create a batch of encrypted NFTs that can be revealed at a later time.

Example

// the real NFTs, these will be encrypted until your reveal them!
const realNFTs = [
{
name: "Common NFT #1",
description: "Common NFT, one of many.",
image: fs.readFileSync("path/to/image.png"),
},
{
name: "Super Rare NFT #2",
description: "You got a Super Rare NFT!",
image: fs.readFileSync("path/to/image.png"),
},
];
// A placeholder NFT that people will get immediately in their wallet, until the reveal happens!
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!",
};
// Create and encrypt the NFTs
await contract.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
// Whenever you're ready, reveal your NFTs at any time!
const batchId = 0; // the batch to reveal
await contract.revealer.reveal(batchId, "my secret password");

Signature:

createDelayedRevealBatch(placeholder: NFTMetadataInput, metadatas: NFTMetadataInput[], password: string, options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<TransactionResultWithId[]>;

Parameters

ParameterTypeDescription
placeholderNFTMetadataInputthe placeholder NFT to show before the reveal
metadatasNFTMetadataInput[]the final NFTs that will be hidden
passwordstringthe password that will be used to reveal these NFTs
options{ onProgress: (event: UploadProgressEvent) => void; }(Optional) additional options like upload progress

Returns:

Promise<TransactionResultWithId[]>

Remarks

Create a batch of encrypted NFTs that can be revealed at a later time.