Skip to main content

Edition Drop

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

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

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

The extensions that the edition drop contract supports are listed below.

claim

Claim a specified number of tokens to the connected wallet.

token_id = 0
quantity = 1

tx = contract.claim(token_id, quantity)
receipt = tx.receipt
claimed_token_id = tx.id
claimed_nft = tx.data()
Configuration

token_id (required)

The token ID of the NFT you want to claim.

Must be an int.

quantity (required)

The number of tokens to claim.

Must be an int.

claim_to

The same as claim, but allows specifying the recipient address rather than using the connected wallet.

address = "0x7fDae677aA6f94Edff9872C4b91D26407709c790"
token_id = 0
quantity = 1

tx = contract.claim_to(address, token_id, quantity)
receipt = tx.receipt
claimed_token_id = tx.id
claimed_nft = tx.data()
Configuration

recipient (required)

The wallet address to receive the claimed tokens.

Must be a string.

token_id (required)

The token ID of the NFT you want to claim.

Must be an int.

quantity (required)

The number of tokens to claim.

Must be an int.

get_active

Retrieve the currently active claim phase for a specific token ID, if any.

 active_phase =  contract.claim_conditions.get_active(
"{{token_id}}",
)
Configuration

token_id (required)

The token ID of the NFT you want to get the claim conditions for.

Must be an int.

Return Value

If there is no active claim phase, returns undefined.

If a claim condition is active, returns a ClaimCondition object containing the following properties:

{
maxClaimableSupply: string
startTime: Date
price: BigNumber
currencyAddress: string
maxClaimablePerWallet: string
waitInSeconds: BigNumber
merkleRootHash: string | number[]
availableSupply: string
currentMintSupply: string
currencyMetadata: {
symbol: string
value: BigNumber
name: string
decimals: number
displayValue: string
}
metadata?: {
[x: string]: unknown
name?: string | undefined
} | undefined
snapshot?: {
price?: string | undefined
currencyAddress?: string | undefined
address: string
maxClaimable: string
}[] | null | undefined
}

create_batch

Lazy mint a new batch of NFTs into the smart 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 instead of objects.

The metadata must conform to the metadata standards.

from thirdweb.types.nft import NFTMetadataInput, EditionMetadataInput

# Note that you can customize this metadata however you like
metadatas = [
EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
})
),
EditionMetadataInput(
NFTMetadataInput.from_json({
"name": "Cooler NFT",
"description": "This is a cooler NFT",
"image": open("path/to/file.jpg", "rb"),
})
)
]

txs = contract.create_batch(metadata)
first_token_id = txs[0].id
first_nft = txs[0].data()

Alternatively, you can provide a string that points to valid metadata instead of objects.

metadata_one = EditionMetadataInput("ipfs://Qm...") # IPFS URI
metadata_two = EditionMetadataInput("https://my-nft-metadata.json") # Some other URL

txs = contract.create_batch([metadata_one, metadata_two])
Configuration

metadatas

Provide a list of either strings that point to valid metadata properties, or EditionMetadataInput objects that contain NFTMetadataInput objects.

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
attributes: Optional[Dict[str, Any]] = None