Skip to main content

Edition Drop

Learn how to interact with your Edition Drop contract in the SDK.

Create an Edition Drop Contract

const sdk = useSDK();

const contractAddress = await sdk.deployer.deployEditionDrop({
name: "My Edition Drop",
primary_sale_recipient: "your-address",
});
View in React SDK Documentation

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.

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
}

Lazy Minting Your NFTs

Create a batch of NFTs to be claimed in the future
// 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
View in React SDK Documentation

Setting Claim Phases

Configure claim conditions for each NFT
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);
View in React SDK Documentation

Setting Royalty Fees

Configure royalties
// 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..."
});
View in React SDK Documentation

Minting / Claiming NFTs

Claim NFTs to a specific Wallet
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>
);
};
View in React SDK Documentation

Airdrop NFTs

Viewing NFTs

One NFT

Get a single NFT
const nft = await contract.get("0");
View in React SDK Documentation

All NFTs

Get all NFTs
const { data: nfts, isLoading, error } = useNFTs(contract, { start: 0, count: 100 });
View in React SDK Documentation

NFTs owned by a specific wallet

Get all NFTs owned by a specific wallet
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
View in React SDK Documentation

Amount of tokens owned by a specific wallet

Get NFT Balance
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);
View in React SDK Documentation

Transferring NFTs

Burning NFTs

Burn a specified amount of a NFT
const result = await contract.burnTokens(tokenId, amount);
View in React SDK Documentation