The PayloadToSign1155
object you provide to the generate
function outlines what the signature can be used for.
PayloadToSign1155 = Signature1155PayloadInput
class Signature1155PayloadInput:
to: str
metadata: NFTMetadataInput
token_id: int
quantity: int
royalty_recipient: str = ZERO_ADDRESS
royalty_bps: int = 0
price: Price = 0
currency_address: str = NATIVE_TOKEN_ADDRESS
mint_start_time: int = int(time())
mint_end_time: int = int(time()) + 60 * 60 * 24 * 1000 * 1000
uid: Optional[bytes] = None
primary_sale_recipient: Optional[str] = ZERO_ADDRESS
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
The quantity
, to
, token_id
and metadata
fields are required, while the rest are optional.
quantity (required)
The number of tokens this signature can be used to mint.
Must be an int
.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
))
to (required)
The wallet address that can use this signature to mint tokens.
This is to prevent another wallet from intercepting the signature and using it to mint tokens for themselves.
Must be of type string
.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
))
token_id (required)
The token ID of the NFT to mint.
Must be of type int
.
The metadata of the NFT to mint.
Can either be a string
URL that points to valid metadata that conforms to the metadata standards,
or an NFTMetadataInput
object that conforms to the same standards.
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
If you provide an object, the metadata is uploaded and pinned to IPFS before
the NFT(s) are minted.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
))
currency_address (optional)
The address of the currency to pay for minting the tokens (use the price
field to specify the price).
Defaults to NATIVE_TOKEN_ADDRESS
(the native currency of the network, e.g. Ether on Ethereum).
Must be of type str
.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
const signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
currency_address = "{{currency_contract_address}}",
))
price (optional)
If you want the user to pay for minting the tokens, you can specify the price per token.
Defaults to 0
(free minting).
Must be of type float
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
price = "{{price}}",
))
mint_start_time (optional)
The time from which the signature can be used to mint tokens.
Defaults to time()
(now).
Must be of type int
.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
mint_start_time = int(time),
))
mint_end_time (optional)
The time until which the signature can be used to mint tokens.
Defaults to int(time() + 1000 * 60 * 60 * 24 * 365 * 10),
(10 years from now).
Must be of type int
.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
mint_end_time = int(time() + 60 * 60 * 24 * 1000),
))
primary_sale_recipient (optional)
If a price
is specified, the funds will be sent to the primary_sale_recipient
address.
Defaults to the primary_sale_recipient
address of the contract.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
price = "{{price}}",
primary_sale_recipient = "{{wallet_address}}",
))
royalty_bps (optional)
The percentage fee you want to charge for secondary sales.
Defaults to the royaltyBps
of the contract.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
price = "{{price}}",
royalty_bps = 500,
))
royalty_recipient (optional)
The address that will receive the royalty fees from secondary sales.
Defaults to the royaltyRecipient
address of the contract.
from thirdweb.types.contracts.signature import PayloadToSign1155
from thirdweb.types.nft import NFTMetadataInput
signature = contract.erc1155.signature.generate(PayloadToSign1155(
quantity = "{{quantity}}",
to = "{{wallet_address}}",
metadata = NFTMetadataInput.from_json(
),
price = "{{price}}",
royalty_bps = 500,
royalty_recipient = "{{wallet_address}}",
))