Edition
When using the Edition smart contract, there is no need to provide a contract type argument, as the functionality of the smart contract is all available through the extensions interface.
The extensions that the edition contract supports are listed below.
- ERC1155
- ERC1155Burnable
- ERC1155Enumerable
- ERC1155Mintable
- ERC1155BatchMintable
- ERC1155SignatureMintable
- Royalty
- PlatformFee
- PrimarySale
- Permissions
- ContractMetadata
- Ownable
- Gasless
airdrop
Transfer NFTs from the connected wallet to multiple different wallets at once.
const txResult = await contract.erc1155.airdrop(
// Token ID of the NFT to transfer
"{{token_id}}",
// Array of wallet addresses to transfer to
[
{
address: "{{wallet_address}}", // Wallet address to transfer to
quantity: 1, // Quantity of the NFT to transfer
},
{
address: "{{wallet_address}}", // Wallet address to transfer to
quantity: 2, // Quantity of the NFT to transfer
},
],
);
Configuration
balance
Get the quantity of a specific NFT owned by the connected wallet.
const tokenId = 0; // Id of the NFT to check
const balance = await contract.erc1155.balanceOf(tokenId);
Configuration
balanceOf
Get the quantity of a specific NFT owned by a wallet.
// Address of the wallet to check NFT balance
const walletAddress = "{{wallet_address}}";
const tokenId = 0; // Id of the NFT to check
const balance = await contract.erc1155.balanceOf(walletAddress, tokenId);
Configuration
burn
Burn the specified NFTs from the connected wallet.
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of the NFT you want to burn
const amount = 2;
const txResult = await contract.erc1155.burn(tokenId, amount);
Configuration
burnFrom
The same as burn
, but allows you to specify the wallet to burn NFTs from.
// The address of the wallet to burn NFTS from
const account = "0x...";
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of this NFT you want to burn
const amount = 2;
const txResult = await contract.erc1155.burnFrom(account, tokenId, amount);
Configuration
burnBatch
Burn multiple different NFTs in the same transaction from the connected wallet.
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];
const result = await contract.erc1155.burnBatch(tokenIds, amounts);
Configuration
burnBatchFrom
Burn the batch NFTs from the specified wallet
// The address of the wallet to burn NFTS from
const address = "0x...";
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];
const result = await contract.erc1155.burnBatchFrom(address, tokenIds, amounts);
Configuration
generate
Generate a signature that a wallet address can use to mint the specified number of NFTs.
This is typically an admin operation, where the owner of the contract generates a signature that allows another wallet to mint tokens.
const payload = {
quantity: 100, // (Required) The quantity of tokens to be minted
to: "{{wallet_address}}", // (Required) Who will receive the tokens
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
currencyAddress: "{{currency_contract_address}}", // (Optional) the currency to pay with
price: 0.5, // (Optional) the price to pay for minting those tokens (in the currency above)
mintStartTime: new Date(), // (Optional) can mint anytime from now
mintEndTime: new Date(Date.now() + 60 * 60 * 24 * 1000), // (Optional) to 24h from now,
primarySaleRecipient: "0x...", // (Optional) custom sale recipient for this token mint
};
const signedPayload = contract.erc1155.signature.generate(payload);
Configuration
generateBatch
Generate a batch of signatures at once.
This is the same as generate
but it allows you to generate multiple signatures at once.
const signatures = await contract.erc1155.signature.generateBatch([
{
to: "{{wallet_address}}",
quantity: "{{quantity}}",
metadata: {
// ... Your NFT metadata
},
}
{
to: "{{wallet_address}}",
quantity: "{{quantity}}",
metadata: {
// ... Your NFT metadata
},
}
]);
Configuration
generateFromTokenId
Generate a signature that can be used to mint additional supply of an existing NFT in the contract.
This is the same as generate
but it allows you to specify the tokenId
of the NFT you want to mint additional supply for, rather than
providing the metadata
of the NFT. Each other configuration option is the same as generate
.
const signature = await contract.erc1155.signature.generateFromTokenId({
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
});
Configuration
generateBatchFromTokenIds
Generate a batch of signatures that can be used to mint additional supply of existing NFTs in the contract.
This is the same as generateBatch
but allows you to generate multiple signatures at once.
const signatures = await contract.erc1155.signature.generateBatchFromTokenIds([
{
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
},
{
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
},
]);
Configuration
get
Get the metadata of an NFT using it’s token ID.
Metadata is fetched from the uri
property of the NFT.
If the metadata is hosted on IPFS, the metadata is fetched and made available as an object.
The object’s image
property will be a URL that is available through the thirdweb IPFS gateway.
const nft = await contract.erc1155.get(0);
Configuration
get - Contract Metadata
Get the metadata of a smart contract.
const metadata = await contract.metadata.get();
Configuration
get - Owner
Retrieve the wallet address of the owner of the smart contract.
const owner = await contract.owner.get();
Configuration
get - Permissions
Get a list of wallet addresses that are members of a given role.
const members = await contract.roles.get("{{role_name}}");
Configuration
get - Platform Fee
Get the platform fee recipient and basis points.
const feeInfo = await contract.platformFee.get();
Configuration
getAll - Permissions
Retrieve all of the roles and associated wallets.
const allRoles = await contract.roles.getAll();
Configuration
getDefaultRoyaltyInfo
Gets the royalty recipient and BPS (basis points) of the smart contract.
const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
Configuration
getMintTransaction
Construct a mint transaction without executing it. This is useful for estimating the gas cost of a mint transaction, overriding transaction options and having fine grained control over the transaction execution.
const txResult = await contract.erc1155.getMintTransaction(
"{{wallet_address}}", // Wallet address to mint to
{
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
supply: 1000, // The number of this NFT you want to mint
},
);
Configuration
getRecipient
Get the primary sale recipient.
const salesRecipient = await contract.sales.getRecipient();
Configuration
getTokenRoyaltyInfo
Gets the royalty recipient and BPS (basis points) of a particular token in the contract.
const royaltyInfo = await contract.royalties.getTokenRoyaltyInfo(
"{{token_id}}",
);
Configuration
grant - Permissions
Make a wallet a member of a given role.
const txResult = await contract.roles.grant(
"{{role_name}}",
"{{wallet_address}}",
);
Configuration
isApproved
Get whether this wallet has approved transfers from the given operator.
This means that the operator can transfer NFTs on behalf of this wallet.
const isApproved = await contract.erc1155.isApproved(
// Address of the wallet to check
"{{wallet_address}}",
// Address of the operator to check
"{{wallet_address}}",
);
Configuration
lazyMint
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.
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadataOne = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const metadataTwo = {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const txResult = await contract.erc1155.lazyMint([metadataOne, metadataTwo]);
Alternatively, you can provide a string
that points to valid metadata instead of objects.
const metadataOne = "ipfs://Qm..."; // IPFS URI
const metadataTwo = "https://my-nft-metadata.json"; // Some other URL
const txResult = await contract.erc1155.lazyMint([metadataOne, metadataTwo]);
Configuration
transfer
Transfer an NFT from the connected wallet to another wallet.
// Address of the wallet you want to send the NFT to
const toAddress = "{{wallet_address}}";
const tokenId = "0"; // The token ID of the NFT you want to send
const amount = 3; // How many copies of the NFTs to transfer
await contract.erc1155.transfer(toAddress, tokenId, amount);
Configuration
mint
Mint a new NFT to the connected wallet.
const metadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const tx = await contract.erc1155.mint({
metadata: metadata,
supply: 1000, // The number of this NFT you want to mint
});
Configuration
mint - Signature-based
Mint tokens from a previously generated signature (see generate
).
// Use the signed payload to mint the tokens
const txResult = contract.erc1155.signature.mint(signature);
Configuration
mintAdditionalSupply
Mint additional quantity of an NFT that already exists on the contract.
const tokenId = 0;
const additionalSupply = 1000;
const txResult = await contract.erc1155.mintAdditionalSupply(
tokenId,
additionalSupply,
);
Configuration
mintAdditionalSupplyTo
The same as mintAdditionalSupply
, but allows you to specify the address of the wallet rather than using the connected wallet.
const toAddress = "{{wallet_address}}";
const tokenId = 0;
const additionalSupply = 1000;
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
toAddress,
tokenId,
additionalSupply,
);
Configuration
mintBatch
Mint many different NFTs with limited supplies to the connected wallet.
// Custom metadata and supplies of your NFTs
const metadataWithSupply = [
{
supply: 50, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
{
supply: 100, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
];
const txResult = await contract.erc1155.mintBatch(metadataWithSupply);
Configuration
mintBatch - Signature-based
Use multiple signatures at once to mint tokens.
This is the same as mint
but it allows you to provide multiple signatures at once.
// Use the signed payloads to mint the tokens
const txResult = contract.erc1155.signature.mintBatch(signatures);
Configuration
mintBatchTo
The same as mintBatch
, but allows you to specify the wallet, rather than using the connected one.
// Address of the wallet you want to mint the NFT to
const toAddress = "{{wallet_address}}";
// Custom metadata and supplies of your NFTs
const metadataWithSupply = [
{
supply: 50, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
{
supply: 100, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
];
const txResult = await contract.erc1155.mintBatchTo(
toAddress,
metadataWithSupply,
);
Configuration
mintTo
The same as mint
, but allows you to specify the address of the wallet rather than using the connected wallet.
// Address of the wallet you want to mint the NFT to
const toAddress = "{{wallet_address}}";
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
};
const txResult = await contract.erc1155.mintTo(toAddress, metadataWithSupply);
Configuration
nextTokenIdToMint
Get the next token ID that will be minted on the contract.
const nextTokenId = await contract.erc1155.nextTokenIdToMint();
Configuration
revoke - Permissions
Revoke a given role from a wallet.
const txResult = await contract.roles.revoke(
"{{role_name}}",
"{{wallet_address}}",
);
Configuration
set - Contract Metadata
Overwrite the metadata of a contract, an object following the contract level metadata standards.
This operation ignores any existing metadata and replaces it with the new metadata provided.
const txResult = await contract.metadata.set({
name: "My Contract",
description: "My contract description",
});
Configuration
Set the primary sale recipient.
await contract.sales.setRecipient("{{wallet_address}}");
Configuration
set - Owner
Set the owner address of the contract.
const txResult = await contract.owner.set("{{wallet_address}}");
Configuration
set - Platform Fee
Set the platform fee recipient and basis points.
const txResult = await contract.platformFees.set({
platform_fee_basis_points: 100,
platform_fee_recipient: "0x123",
});
Configuration
setAll - Permissions
Overwrite all roles with new members.
This overwrites all members, INCLUDING YOUR OWN WALLET ADDRESS!
This means you can permanently remove yourself as an admin, which is non-reversible.
Please use this method with caution.
const txResult = await contract.roles.setAll({
admin: ["0x12", "0x123"],
minter: ["0x1234"],
});
Configuration
setApprovalForAll
Give another address approval (or remove approval) to transfer all of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
const txResult = await contract.erc1155.setApprovalForAll(
// Address of the wallet to approve
"{{wallet_address}}",
// Whether to grant approval (true) or remove approval (false)
true,
);
Configuration
setDefaultRoyaltyInfo
Set the royalty recipient and fee for the smart contract.
await contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1% royalty fee
fee_recipient: "0x...", // the fee recipient
});
Configuration
setTokenRoyaltyInfo
Set the royalty recipient and fee for a particular token in the contract.
await contract.royalties.setTokenRoyaltyInfo("{{token_id}}", {
seller_fee_basis_points: 100, // 1% royalty fee
fee_recipient: "0x...", // the fee recipient
});
Configuration
totalCirculatingSupply
Get the total circulating supply of a token in the collection.
Circulating supply considers NFTs that have not been burned.
const totalCirculatingSupply = await contract.erc1155.totalCirculatingSupply(
"{{token_id}}",
);
Configuration
totalSupply
Returns the total supply of a token in the collection, including burned tokens.
const totalSupply = await contract.erc1155.totalSupply("{{token_id}}");
Configuration
update - Contract Metadata
Update the metadata of your smart contract.
const txResult = await contract.metadata.update({
name: "My Contract",
description: "My contract description",
});
Configuration
verify - Signature-based
Verify that a payload is correctly signed.
This allows you to provide a payload, and prove that it was valid and was generated by a wallet with permission to generate signatures.
If a payload is not valid, the mint
/mintBatch
functions will fail,
but you can use this function to verify that the payload is valid before attempting to mint the tokens
if you want to show a more user-friendly error message.
// Provide the generated payload to verify that it is valid
const isValid = await contract.erc1155.signature.verify(payload);
Configuration
verify - Permissions
Check to see if a wallet has a set of roles.
Throws an error if the wallet does not have any of the given roles.
const verifyRole = await contract.roles.verify(
["admin", "minter"],
"{{wallet_address}}",
);