Edition Drop
Learn how to interact with your Edition Drop contract in the SDK.
Create an Edition Drop Contract
- React
- Javascript
- Python
- Go
- Unity
const sdk = useSDK();
const contractAddress = await sdk.deployer.deployEditionDrop({
name: "My Edition Drop",
primary_sale_recipient: "your-address",
});
const contractAddress = await sdk.deployer.deployEditionDrop({
name: "My Edition Drop",
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
.DeployEditionDrop(new NFTContractDeployMetadata()
{ name = "My Collection", primary_sale_recipient = "0x..." });
Getting the contract in your application
To start using your Edition Drop contract inside your application, you need to use its contract address. You can get the contract address from the dashboard.
- React
- Javascript
- Python
- Go
- Unity
import { useContract } from '@thirdweb-dev/react'
export default function Component() {
const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "edition-drop")
// Now you can use the edition drop contract in the rest of the component
}
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
const sdk = new ThirdwebSDK("{{chainName}}");
const contract = await sdk.getContract("{{contract_address}}", "edition-drop");
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_drop("{{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}}");
Lazy Minting Your NFTs
- React
- Javascript
- Python
- Go
- Unity
// Custom metadata of the NFTs to create
const metadatas = [{
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}, {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"),
}];
const results = await contract.createBatch(metadatas); // uploads and creates the NFTs on chain
const firstTokenId = results[0].id; // token id of the first created NFT
const firstNFT = await results[0].data(); // (optional) fetch details of the first created NFT
// Custom metadata of the NFTs to create
const metadatas = [{
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}, {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"),
}];
const results = await contract.createBatch(metadatas); // uploads and creates the NFTs on chain
const firstTokenId = results[0].id; // token id of the first created NFT
const firstNFT = await results[0].data(); // (optional) fetch details of the first created NFT
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!
Setting Claim Phases
- React
- Javascript
- Python
- Go
- Unity
const presaleStartTime = new Date();
const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const claimConditions = [
{
startTime: presaleStartTime, // start the presale now
maxClaimableSupply: 2, // limit how many mints for this presale
price: 0.01, // presale price
snapshot: ['0x...', '0x...'], // limit minting to only certain addresses
},
{
startTime: publicSaleStartTime, // 24h after presale, start public sale
price: 0.08, // public sale price
}
]);
const tokenId = 0; // the id of the NFT to set claim conditions on
await contract.claimConditions.set(tokenId, claimConditions);
const presaleStartTime = new Date();
const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const claimConditions = [
{
startTime: presaleStartTime, // start the presale now
maxClaimableSupply: 2, // limit how many mints for this presale
price: 0.01, // presale price
snapshot: ['0x...', '0x...'], // limit minting to only certain addresses
},
{
startTime: publicSaleStartTime, // 24h after presale, start public sale
price: 0.08, // public sale price
}
]);
const tokenId = 0; // the id of the NFT to set claim conditions on
await contract.claimConditions.set(tokenId, claimConditions);
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!
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 / Claiming NFTs
- React
- Javascript
- Python
- Go
- Unity
const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: claimNFT,
isLoading,
error,
} = useClaimNFT(contract);
if (error) {
console.error("failed to claim nft", error);
}
return (
<button
disabled={isLoading}
onClick={() => claimNFT({ to: "{{wallet_address}}", quantity: 1 })}
>
Claim NFT!
</button>
);
};
const address = "{{wallet_address}}"; // address of the wallet you want to claim the NFTs
const tokenId = 0; // the id of the NFT you want to claim
const quantity = 1; // how many NFTs you want to claim
const tx = await contract.claimTo(address, tokenId, quantity);
const receipt = tx.receipt; // the transaction receipt
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!
var address = "{{wallet_address}}"; // address of the wallet you want to claim the NFTs
var quantity = 1; // how many unique NFTs you want to claim
var tx = await contract.ERC1155.ClaimTo(address, quantity);
Airdrop NFTs
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 { data: nfts, isLoading, error } = useNFTs(contract, { start: 0, count: 100 });
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
const { data: ownerBalance, isLoading, error } = useNFTBalance(contract, "{{wallet_address}}");
// for ERC1155 contracts, you can also pass a tokenId
const tokenId = 0;
const { data: ownerBalance, isLoading, error } = useNFTBalance(contract, "{{wallet_address}}", 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
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!
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!
var tokenId = "0";
int amount = 1;
var result = await contract.ERC1155.Burn(tokenId, amount);