ERC721BatchMintable
Functionality available for contracts that implement the
ERC721
,
ERC721Mintable
, and
Multicall
extensions.
Allows you to mint multiple NFTs at once to a wallet.
By default, the NFT metadata is uploaded and pinned to IPFS before minting. You can override this default behavior by providing an array of URLs as string
s
that point to valid metadata objects.
mint_batch_to
Mint multiple NFTs to a specified wallet address.
from thirdweb.types.nft import NFTMetadataInput
# You can customize this metadata however you like
metadatas = [
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
}),
NFTMetadataInput.from_json({
"name": "Cooler NFT",
"description": "This is a cooler NFT",
"image": open("path/to/file.jpg", "rb"),
}),
]
# You can pass in any address here to mint the NFT to
txs = contract.erc721.mint_batch(metadatas)
receipt = txs[0].receipt
first_token_id = txs[0].id
first_nft = txs[0].data()
Configuration
receiver
The wallet address to mint the NFTs to.
Must be a string
.
metadatas = [
# ...
]
tx = contract.erc721.mint_batch_to(
"{{wallet_address}}",
metadatas,
)
metadatas
An array of metadata objects for the NFTs you want to mint.
Must be an List
of NFTMetadata
object
s that conform to the metadata standards.
Alternatively, you can provide an array of string
s that point to valid metadata objects,
to override the default behavior of uploading and pinning the metadata to IPFS (shown below).
metadatas = [
"https://example.com/metadata1.json",
"ipfs://my-ipfs-hash",
"https://some-other-url.com/metadata2.json",
]
tx = contract.erc721.mint_batch_to(
"{{wallet_address}}",
metadatas,
)