Signature Drop
Learn how to interact with your Signature Drop contract in the SDK.
Create a Signature Drop Contract
- React
- Javascript
- Python
- Go
const sdk = useSDK();
const contractAddress = await sdk.deployer.deploySignatureDrop({
name: "My Signature Drop",
primary_sale_recipient: "your-address",
});
const contractAddress = await sdk.deployer.deploySignatureDrop({
name: "My Signature Drop",
primary_sale_recipient: "your-address",
});
Python SDK support for deploySignatureDrop is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for deploySignatureDrop is coming soon.
Want this feature sooner? Let us know in Discord!
Getting the contract in your application
To start using your Signature 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
import { useSignatureDrop } from '@thirdweb-dev/react'
export default function Component() {
const signatureDrop = useSignatureDrop("<YOUR-CONTRACT-ADDRESS>")
// Now you can use the Signature drop contract in the rest of the component
}
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
const sdk = new ThirdwebSDK("{{chainName}}");
const contract = sdk.getSignatureDrop("{{contract_address}}");
Python SDK support for initializing the SDK is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for initializing the SDK is coming soon.
Want this feature sooner? Let us know in Discord!
Lazy Minting Your NFTs
- React
- Javascript
- Python
- Go
// 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
Python SDK support for createBatch is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for createBatch is coming soon.
Want this feature sooner? Let us know in Discord!
Setting Claim Phases
- React
- Javascript
- Python
- Go
const presaleStartTime = new Date();
const claimCondition = {
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
};
await contract.claimConditions.set([claimCondition]);
const presaleStartTime = new Date();
const claimCondition = {
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
};
await contract.claimConditions.set([claimCondition]);
Python SDK support for claimConditions is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for claimConditions is coming soon.
Want this feature sooner? Let us know in Discord!
Delayed Reveals
- React
- Javascript
- Python
- Go
// 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");
// 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");
Python SDK support for revealer is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for revealer is coming soon.
Want this feature sooner? Let us know in Discord!
Setting Royalty Fees
- React
- Javascript
- Python
- Go
// 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..."
});
Python SDK support for royalties is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for royalties is coming soon.
Want this feature sooner? Let us know in Discord!
Minting / Claiming NFTs
- React
- Javascript
- Python
- Go
const Component = () => {
const {
mutate: claimNft,
isLoading,
error,
} = useClaimNFT(DropContract);
if (error) {
console.error("failed to claim nft", error);
}
return (
<button
disabled={isLoading}
onClick={() => claimNft({ to: "0x...", quantity: 1 })}
>
Claim NFT!
</button>
);
};
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.receipt; // the transaction receipt
const claimedTokenId = tx.id; // the id of the NFT claimed
const claimedNFT = await tx.data(); // (optional) get the claimed NFT metadata
Python SDK support for claimTo is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for claimTo is coming soon.
Want this feature sooner? Let us know in Discord!
Signature Minting
- React
- Javascript
- Python
- Go
// see how to craft a payload to sign in the `contract.signature.generate()` documentation
const signedPayload = contract.signature.generate(payload);
// now anyone can mint the NFT
const tx = contract.signature.mint(signedPayload);
const receipt = tx.receipt; // the mint transaction receipt
const mintedId = tx.id; // the id of the NFT minted
// see how to craft a payload to sign in the `contract.signature.generate()` documentation
const signedPayload = contract.signature.generate(payload);
// now anyone can mint the NFT
const tx = contract.signature.mint(signedPayload);
const receipt = tx.receipt; // the mint transaction receipt
const mintedId = tx.id; // the id of the NFT minted
Python SDK support for signature is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for signature is coming soon.
Want this feature sooner? Let us know in Discord!
Viewing NFTs
One NFT
- React
- Javascript
- Python
- Go
const { contract } = useContract(<ContractAddress>);
const { data: nft, isLoading, error } = useNFT(contract?.nft, <tokenId>);
const tokenId = 0;
const nft = await contract.nft.get(tokenId);
Python SDK support for get is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for get is coming soon.
Want this feature sooner? Let us know in Discord!
All NFTs
- React
- Javascript
- Python
- Go
const { contract } = useContract(<ContractAddress>);
const { data: nfts, isLoading, error } = useNFTs(contract?.nft, { start: 0, count: 100 });
const nfts = await contract.getAll();
console.log(nfts);
Python SDK support for getAll is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for getAll is coming soon.
Want this feature sooner? Let us know in Discord!
Claimed NFTs
- React
- Javascript
- Python
- Go
const { data: claimedNFTs, isLoading, error } = useClaimedNFTs(<YourERC721DropContractInstance>, { start: 0, count: 100 });
const claimedNFTs = await contract.getAllClaimed();
const firstOwner = claimedNFTs[0].owner;
Python SDK support for getAllClaimed is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for getAllClaimed is coming soon.
Want this feature sooner? Let us know in Discord!
Unclaimed NFTs
- React
- Javascript
- Python
- Go
const { data: unclaimedNfts, isLoading, error } = useUnclaimedNFTs(<YourERC721DropContractInstance>, { start: 0, count: 100 });
const unclaimedNFTs = await contract.getAllUnclaimed();
const firstUnclaimedNFT = unclaimedNFTs[0].name;
Python SDK support for getAllUnclaimed is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for getAllUnclaimed is coming soon.
Want this feature sooner? Let us know in Discord!
NFTs owned by a specific wallet
- React
- Javascript
- Python
- Go
const { contract } = useContract(<ContractAddress>);
const { data: ownedNFTs, isLoading, error } = useOwnedNFTs(contract?.nft, <OwnerWalletAddress>);
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
console.log(nfts);
Python SDK support for getOwned is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for getOwned is coming soon.
Want this feature sooner? Let us know in Discord!
Balance of a specific wallet
- React
- Javascript
- Python
- Go
const { contract } = useContract(<ContractAddress>);
const { data: ownerBalance, isLoading, error } = useNFTBalance(contract?.nft, <OwnerWalletAddress>);
const walletAddress = "{{wallet_address}}";
const balance = await contract.nft.balanceOf(walletAddress);
console.log(balance);
Python SDK support for balanceOf is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for balanceOf is coming soon.
Want this feature sooner? Let us know in Discord!
Viewing Supply
Claimed supply
- React
- Javascript
- Python
- Go
const claimedNFTCount = await contract.totalClaimedSupply();
console.log(`NFTs claimed so far: ${claimedNFTCount}`);
const claimedNFTCount = await contract.totalClaimedSupply();
console.log(`NFTs claimed so far: ${claimedNFTCount}`);
Python SDK support for totalClaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for totalClaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
Unclaimed supply
- React
- Javascript
- Python
- Go
const unclaimedNFTCount = await contract.totalUnclaimedSupply();
console.log(`NFTs left to claim: ${unclaimedNFTCount}`);
const unclaimedNFTCount = await contract.totalUnclaimedSupply();
console.log(`NFTs left to claim: ${unclaimedNFTCount}`);
Python SDK support for totalUnclaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for totalUnclaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
Transferring NFTs
- React
- Javascript
- Python
- Go
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.nft.transfer(walletAddress, tokenId);
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.nft.transfer(walletAddress, tokenId);
Python SDK support for transfer is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for transfer is coming soon.
Want this feature sooner? Let us know in Discord!