Skip to main content

EditionDrop.createBatch() method

Create a batch of NFTs to be claimed in the future

Example

// 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.createBatch(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

Signature:

createBatch(metadatas: NFTMetadataOrUri[], options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<TransactionResultWithId<NFTMetadata>[]>;

Parameters

ParameterTypeDescription
metadatasNFTMetadataOrUri[]The metadata to include in the batch.
options{ onProgress: (event: UploadProgressEvent) => void; }(Optional) optional upload progress callback

Returns:

Promise<TransactionResultWithId<NFTMetadata>[]>

Remarks

Create batch allows you to create a batch of many NFTs in one transaction.