ERC1155Mintable
Functionality available for contracts that extend the
ERC1155
and
ERC1155Mintable
extensions.
Allows you to mint new NFTs on the contract.
By default, the NFT metadata is uploaded and pinned to IPFS before minting.
You can override this default behavior by providing a string
that points to valid metadata object instead of an object.
mint
Mint a new NFT to the connected wallet.
from thirdweb.types.nft import NFTMetadataInput, EditionMetadataInput
# Note that you can customize this metadata however you like
metadata_with_supply = EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
}),
100
)
# You can pass in any address here to mint the NFT to
tx = contract.erc1155.mint(metadata_with_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
Configuration
mint_to
The same as mint
, but allows you to specify the address of the wallet rather than using the connected wallet.
from thirdweb.types.nft import NFTMetadataInput, EditionMetadataInput
# Note that you can customize this metadata however you like
metadata_with_supply = EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
}),
100
)
# You can pass in any address here to mint the NFT to
tx = contract.erc1155.mint_to("0x7fDae677aA6f94Edff9872C4b91D26407709c790", metadata_with_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
Configuration
mint_additional_supply
Mint additional quantity of an NFT that already exists on the contract.
token_id = 0
additional_supply = 1
tx = contract.erc1155.mint_additional_supply(token_id, additional_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
Configuration
mint_additional_supply_to
The same as mint_additional_supply
, but allows you to specify the address of the wallet rather than using the connected wallet.
to = "0x7fDae677aA6f94Edff9872C4b91D26407709c790"
token_id = 0
additional_supply = 1
tx = contract.erc1155.mint_additional_supply_to(to, token_id, additional_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()