Edition
Learn how to interact with your Edition contract in the SDK.
Create an Edition Contract
- React
- Javascript
- Python
- Go
- Unity
const sdk = useSDK();
const contractAddress = await sdk.deployer.deployEdition({
name: "My Edition",
primary_sale_recipient: "your-address",
});
const contractAddress = await sdk.deployer.deployEdition({
name: "My Edition",
primary_sale_recipient: "your-address",
});
This feature is missing a code snippet or might not be supported yet.
Check the Python SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
await sdk
.deployer
.DeployEdition(new NFTContractDeployMetadata()
{ name = "My Collection", primary_sale_recipient = "0x..." });
Getting the contract in your application
To start using your Edition contract inside your application, you'll need to use its contract address. You can get the contract address from the dashboard.
- React
- Javascript
- Python
- Go
- Unity
This feature is missing a code snippet or might not be supported yet.
Check the React SDK Reference for more information.
Reach out on Discord for further assistance!
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
const sdk = new ThirdwebSDK("{{chainName}}");
const contract = await sdk.getContract("{{contract_address}}", "edition");
from thirdweb import ThirdwebSDK
# You can customize this to a supported network or your own RPC URL
network = "mumbai"
# Now we can create a new instance of the SDK
sdk = ThirdwebSDK(network)
# If you want to send transactions, you can instantiate the SDK with a private key instead:
# sdk = ThirdwebSDK.from_private_key(PRIVATE_KEY, network)
contract = sdk.get_edition("{{contract_address}}")
import (
"github.com/thirdweb-dev/go-sdk/v2/thirdweb"
)
privateKey = "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
})
contract, err := sdk.GetEditionDrop("{{contract_address}}")
Contract contract = sdk.GetContract("{{contract_address}}");
Setting Royalty Fees
- React
- Javascript
- Python
- Go
- Unity
// royalties on the whole contract
contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1%
fee_recipient: "0x..."
});
// override royalty for a particular token
contract.royalties.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 500, // 5%
fee_recipient: "0x..."
});
// royalties on the whole contract
contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1%
fee_recipient: "0x..."
});
// override royalty for a particular token
contract.royalties.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 500, // 5%
fee_recipient: "0x..."
});
This feature is missing a code snippet or might not be supported yet.
Check the Python SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Unity SDK Reference for more information.
Reach out on Discord for further assistance!
Minting NFTs
Mint One NFT
- React
- Javascript
- Python
- Go
- Unity
// 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",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}
const metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
}
const tx = await contract.mintTo(toAddress, metadataWithSupply);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT
// 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",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}
const metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
}
const tx = await contract.mintTo(toAddress, metadataWithSupply);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT
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_to("{{wallet_address}}", metadata_with_supply)
receipt = tx.receipt
token_id = tx.id
nft = tx.data()
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
// Address of the wallet you want to mint the NFT to
var toAddress = "{{wallet_address}}";
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
var metadata =
new NFTMetadata()
{
name = "Cool NFT",
description = "This is a cool NFT",
image = "<your-image-url>"
};
var metadataWithSupply =
new NFTMetadataWithSupply() { metadata = metadata, supply = 1 };
var tx = await contract.ERC1155.MintTo(toAddress, metadataWithSupply);
Mint Many NFTs (Batch Mint)
- React
- Javascript
- Python
- Go
- Unity
// 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: fs.readFileSync("path/to/image.png"), // This can be an image url or file
},
}, {
supply: 100,
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
},
}];
const tx = await contract.mintBatchTo(toAddress, metadataWithSupply);
const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
const firstTokenId = tx[0].id; // token id of the first minted NFT
const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
// 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: fs.readFileSync("path/to/image.png"), // This can be an image url or file
},
}, {
supply: 100,
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
},
}];
const tx = await contract.mintBatchTo(toAddress, metadataWithSupply);
const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
const firstTokenId = tx[0].id; // token id of the first minted NFT
const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
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("{{wallet_address}}", metadatas_with_supply)
receipt = txs[0].receipt
token_id = txs[0].id
nft = txs[0].data()
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Unity SDK Reference for more information.
Reach out on Discord for further assistance!
Airdrop NFTs
- React
- Javascript
- Python
- Go
- Unity
// The token ID of the NFT you want to airdrop
const tokenId = "0";
// Array of objects of addresses and quantities to airdrop NFTs to
const addresses = [
{
address: "0x...",
quantity: 2,
},
{
address: "0x...",
quantity: 3,
},
];
await contract.airdrop(tokenId, addresses);
// You can also pass an array of addresses, it will airdrop 1 NFT per address
const tokenId = "0";
const addresses = [
"0x...", "0x...", "0x...",
]
await contract.airdrop(tokenId, addresses);
// The token ID of the NFT you want to airdrop
const tokenId = "0";
// Array of objects of addresses and quantities to airdrop NFTs to
const addresses = [
{
address: "0x...",
quantity: 2,
},
{
address: "0x...",
quantity: 3,
},
];
await contract.airdrop(tokenId, addresses);
// You can also pass an array of addresses, it will airdrop 1 NFT per address
const tokenId = "0";
const addresses = [
"0x...", "0x...", "0x...",
]
await contract.airdrop(tokenId, addresses);
This feature is missing a code snippet or might not be supported yet.
Check the Python SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Unity SDK Reference for more information.
Reach out on Discord for further assistance!
Viewing NFTs
One NFT
- React
- Javascript
- Python
- Go
- Unity
const nft = await contract.get("0");
const nft = await contract.get("0");
nft = contract.get(0)
print(nft)
nft, err := contract.Get(context.Background(), 0)
supply := nft.Supply
name := nft.Metadata.Name
var nft = await contract.ERC1155.Get("0");
All NFTs
- React
- Javascript
- Python
- Go
- Unity
const nfts = await contract.getAll();
const nfts = await contract.getAll();
metadatas = contract.get_all()
print(metadatas)
nfts, err := contract.GetAll(context.Background())
supplyOne := nfts[0].Supply
nameOne := nfts[0].Metadata.Name
var nfts = await contract.ERC1155.GetAll();
NFTs owned by a specific wallet
- React
- Javascript
- Python
- Go
- Unity
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
address = "{{wallet_address}}"
owned = contract.get_owned(address)
print(owned)
owner := "{{wallet_address}}"
nfts, err := contract.GetOwned(context.Background(), owner)
name := nfts[0].Metadata.Name
// Address of the Wallet to get the NFTs of
var address = "{{wallet_address}}";
var nfts = await contract.ERC1155.GetOwned(address);
Amount of tokens owned by a specific wallet
- React
- Javascript
- Python
- Go
- Unity
// 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.balanceOf(walletAddress, tokenId);
// 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.balanceOf(walletAddress, tokenId);
address = "{{wallet_address}}"
token_id = 0
balance = contract.balance_of(address, token_id)
address := "{{wallet_address}}"
tokenId := 0
balance, err := contract.BalanceOf(context.Background(), address, tokenId)
// Address of the Wallet to check NFT balance
var walletAddress = "{{wallet_address}}";
var tokenId = "0"; // Id of the NFT to check
var balance = await contract.ERC1155.BalanceOf(walletAddress, tokenId);
Transferring NFTs
- React
- Javascript
- Python
- Go
- Unity
// 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.transfer(toAddress, tokenId, amount);
// 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.transfer(toAddress, tokenId, amount);
to = "{{wallet_address}}"
token_id = 0
amount = 1
receipt = contract.transfer(to, token_id, amount)
to := "0x..."
tokenId := 0
amount := 1
tx, err := contract.Transfer(context.Background(), to, tokenId, amount)
// Address of the Wallet you want to send the NFT to
var toAddress = "{{wallet_address}}";
var tokenId = "0"; // The token ID of the NFT you want to send
var amount = 3; // How many copies of the NFTs to transfer
await contract.ERC1155.Transfer(toAddress, tokenId, amount);
Burning NFTs
- React
- Javascript
- Python
- Go
- Unity
const result = await contract.burnTokens(tokenId, amount);
const result = await contract.burnTokens(tokenId, amount);
This feature is missing a code snippet or might not be supported yet.
Check the Python SDK Reference for more information.
Reach out on Discord for further assistance!
tokenId := 0
amount := 1
tx, err := contract.Burn(context.Background(), tokenId, amount)
var tokenId = "0";
int amount = 1;
var result = await contract.ERC1155.Burn(tokenId, amount);