Skip to main content

NFT Drops

Connect to your NFT Drop program by providing the on-chain address of the program:

import { ThirdwebSDK } from "@thirdweb-dev/sdk/solana";

const sdk = ThirdwebSDK.fromNetwork("devnet");
sdk.wallet.connect(signer);

// Get the interface for your NFT Drop program
const program = await sdk.getProgram("{{program_address}}", "nft-drop");

Get All NFTs

// Get all the NFTs that have been minted on this contract
const nfts = await program.getAll();

console.log(nfts[0].metadata.name);
View in Javascript SDK Documentation

Get NFT Balance

// The address of the wallet to check the balance of
const walletAddress = "..."
// The mint address of the NFT to check the balance of
const nftAddress = "..."
// Get the actual NFT balance of the specified wallet
const balance = await program.balanceOf(walletAddress, nftAddress);
View in Javascript SDK Documentation

Transfer NFTs

// The wallet address to transfer the NFTs to
const to = "...";
// The mint address of the NFT to transfer
const nftAddress = "...";
const tx = await program.transfer(to, nftAddress);
View in Javascript SDK Documentation

Lazy Mint an NFT

// Add the metadata of your NFTs
const metadata = [
{
name: "NFT #1",
description: "My first NFT!",
image: readFileSync("files/image.jpg"),
properties: [
{
name: "coolness",
value: "very cool!"
}
]
}
];

// And lazy mint NFTs to your program
const tx = await program.lazyMint(metadatas);
View in Javascript SDK Documentation

Claim an NFT

// Specify which address to claim the NFTs to
const receiverAddress = "...";
// Claim the NFTs to the specified wallet and get the mint addresses of the NFTs
const claimedAddresses = await program.claimTo(receiverAddress, 1);
console.log("Claimed NFT at address", claimedAddresses[0]);
View in Javascript SDK Documentation

Burn an NFT

// Specify the address of the NFT to burn
const nftAddress = "..."
// And send the actual burn transaction
const tx = await program.burn(nftAddress);
View in Javascript SDK Documentation