ERC1155BatchMintable
Functionality available for contracts that implement the
ERC1155Enumerable
,
ERC1155Mintable
, and
Multicall
extensions.
Allows you to mint multiple NFTs at once to a wallet address.
By default, the NFT metadata is uploaded and pinned to IPFS before minting.
You can override this default behavior by providing a string as the metadata
property
that points to valid metadata object.
mint_batch
Mint many different NFTs with limited supplies to the connected wallet.
from thirdweb.types.nft import NFTMetadataInput, EditionMetadataInput
# Note that you can customize this metadata however you like
metadatas_with_supply = [
EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
}),
100
),
EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cooler NFT",
"description": "This is a cooler NFT",
"image": open("path/to/file.jpg", "rb"),
}),
100
)
]
# You can pass in any address here to mint the NFT to
txs = contract.erc1155.mint_batch(metadatas_with_supply)
receipt = txs[0].receipt
token_id = txs[0].id
nft = txs[0].data()
Configuration
metadata_with_supply
A list of EditionMetadataInput
objects that contain the metadata and supply of each NFT you want to mint.
The supply
property is the number of this NFT you want to mint.
Must be an int
.
The metadata
object must be an NFTMetadataInput
object and follow the metadata standards.
Alternatively, you can provide a string
s that points to a valid metadata object
to override the default behavior of uploading and pinning the metadata to IPFS (shown below).
metadatas = [
{
metadata: "https://example.com/metadata1.json", // Any URI/URL that points to metadata
supply: 50,
},
{
metadata: "ipfs://my-ipfs-hash", // Any URI/URL that points to metadata
supply: 100,
},
]
tx_result = contract.erc1155.mint_batch(metadatas)
mint_batch_to
The same as mint_batch
, but allows you to specify the wallet, rather than using the connected one.
from thirdweb.types.nft import NFTMetadataInput, EditionMetadataInput
# Note that you can customize this metadata however you like
metadatas_with_supply = [
EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
}),
100
),
EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cooler NFT",
"description": "This is a cooler NFT",
"image": open("path/to/file.jpg", "rb"),
}),
100
)
]
# You can pass in any address here to mint the NFT to
txs = contract.erc1155.mint_batch_to("0x7fDae677aA6f94Edff9872C4b91D26407709c790", metadatas_with_supply)
receipt = txs[0].receipt
token_id = txs[0].id
nft = txs[0].data()
Configuration
to_address
The address of the wallet you want to mint the NFT to.
Must be a string
.
# Custom metadata and supplies of your NFTs
const metadata_with_supply = [
# ...
]
tx_result = contract.erc1155.mint_batch_to(
"{{wallet_address}}",
metadata_with_supply,
)
metadata_with_supply
See mint_batch
for more details.