Skip to main content

Edition

When using the Edition smart contract, additional top-level functionality is available to use.

To access the top-level functionality, use the get_edition method when creating the contract instance:

contract = sdk.get_edition(
"{{contract_address}}",
)

The extensions that the edition contract supports are listed below.

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.mint(metadata_with_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
Configuration

metadata_with_supply

A EditionMetadataInput object containing a NFTMetadataInput object and a supply property.

class NFTMetadataInput:
name: str
description: Optional[str] = None
image: Optional[str] = None
external_url: Optional[str] = None
animation_url: Optional[str] = None
background_color: Optional[str] = None
properties: Optional[Dict[str, Any]] = None

The metadata object can either be a string that points to valid metadata that conforms to the metadata standards, or an object that conforms to the same standards.

If you provide an object, the metadata is uploaded and pinned to IPFS before the NFT(s) are minted.

# Below is an example of using a string rather than an object for metadata
metadata = "https://example.com/metadata.json" # Any URL or IPFS URI that points to metadata


tx = contract.mint(EditionMetadataInput(
metadata = metadata,
supply = 1000, # The number of this NFT you want to mint
))

mint_additional_supply

Mint additional quantity of an NFT that already exists on the contract.

token_id = 0
additional_supply = 1

tx = contract.mint_additional_supply(token_id, additional_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
Configuration

token_id

The ID of the NFT you want to mint additional supply for.

Must be an int.

tx = contract.mint_additional_supply(
"{{token_id}}",
"{{additional_supply}}",
)

additional_supply

How much additional supply you want to mint.

Must be an int.

tx = contract.mint_additional_supply(
"{{token_id}}",
"{{additional_supply}}",
)

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.mint_additional_supply_to(to, token_id, additional_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
Configuration

to

The address of the wallet you want to mint the NFT to.

Must be a string.

tx = contract.mint_additional_supply_to(
"{{wallet_address}}",
"{{token_id}}",
"{{additional_supply}}",
)

token_id

The ID of the NFT you want to mint additional supply for.

Must be an int.

tx = contract.mint_additional_supply_to(
"{{wallet_address}}",
"{{token_id}}",
"{{additional_supply}}",
)

additional_supply

How much additional supply you want to mint.

Must be an int.

tx = contract.mint_additional_supply_to(
"{{wallet_address}}",
"{{token_id}}",
"{{additional_supply}}",
)

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.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 strings that points to a valid metadata object to override the default behavior of uploading and pinning the metadata to IPFS (shown below).

from thirdweb.types.nft import EditionMetadataInput

metadatas = [
EditionMetadataInput(
metadata: "https://example.com/metadata1.json", // Any URI/URL that points to metadata
supply: 50,
),
EditionMetadataInput(
metadata: "ipfs://my-ipfs-hash", // Any URI/URL that points to metadata
supply: 100,
),
]

tx_result = contract.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.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.

from thirdweb.types.nft import EditionMetadataInput, NFTMetadataInput
# Custom metadata and supplies of your NFTs
const metadata_with_supply = [
EditionMetadata(
metadata = NFTMetadataInput.from_json(
# ...
),
supply = 100
)
# ...
]

tx_result = contract.mint_batch_to(
"{{wallet_address}}",
metadata_with_supply,
)

metadata_with_supply

See mint_batch for more details.