Skip to main content

NFT Drop

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

Create an NFT Drop Contract

const sdk = useSDK();

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

Getting the contract in your application

To start using your NFT Drop contract inside your application, you need to use its contract address. You can get the contract address from the dashboard.

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!

Lazy Minting Your NFTs

Create a batch of unique 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
const presaleStartTime = new Date();
const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const claimConditions = [
{
startTime: presaleStartTime, // start the presale now
maxQuantity: 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
}
]);
await contract.claimConditions.set(claimConditions);
View in React SDK Documentation

Delayed Reveals

Delayed reveal
// the real NFTs, these will be encrypted until you reveal them
const realNFTs = [{
name: "Common NFT #1",
description: "Common NFT, one of many.",
image: fs.readFileSync("path/to/image.png"),
}, {
name: "Super Rare NFT #2",
description: "You got a Super Rare NFT!",
image: fs.readFileSync("path/to/image.png"),
}];
// A placeholder NFT that people will get immediately in their wallet, and will be converted to the real NFT at reveal time
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!"
};
// Create and encrypt the NFTs
await contract.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
// Whenever you're ready, reveal your NFTs at any time
const batchId = 0; // the batch to reveal
await contract.revealer.reveal(batchId, "my secret password");
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 unique NFTs to a specific Wallet
const address = "{{wallet_address}}"; // address of the wallet you want to claim the NFTs
const quantity = 1; // how many unique NFTs you want to claim

const tx = await contract.claimTo(address, quantity);
const receipt = tx[0].receipt; // the transaction receipt
const claimedTokenId = tx[0].id; // the id of the NFT claimed
const claimedNFT = await tx[0].data(); // (optional) get the claimed NFT metadata
View in React SDK Documentation

Viewing NFTs

One NFT

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

All NFTs

Get All Minted NFTs
const nfts = await contract.getAll();
console.log(nfts);
View in React SDK Documentation

Claimed NFTs

Get All Claimed NFTs
const claimedNFTs = await contract.getAllClaimed();
const firstOwner = claimedNFTs[0].owner;
View in React SDK Documentation

Unclaimed NFTs

Get All Unclaimed NFTs
const unclaimedNFTs = await contract.getAllUnclaimed();
const firstUnclaimedNFT = unclaimedNFTs[0].name;
View in React SDK Documentation

NFTs owned by a specific wallet

Get Owned NFTs
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
console.log(nfts);
View in React SDK Documentation

Viewing Supply

Claimed supply

Get the claimed supply
const claimedNFTCount = await contract.totalClaimedSupply();
console.log(`NFTs claimed so far: ${claimedNFTCount}`);
View in React SDK Documentation

Unclaimed supply

Get the unclaimed supply
const unclaimedNFTCount = await contract.totalUnclaimedSupply();
console.log(`NFTs left to claim: ${unclaimedNFTCount}`);
View in React SDK Documentation

Transferring NFTs

Transfer a single NFT
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.transfer(walletAddress, tokenId);
View in React SDK Documentation

Burning NFTs

Burn a single NFT
const result = await contract.burnToken(tokenId);
View in React SDK Documentation