Burn a single NFT
Rest
...args: [tokenId: BigNumberish]const result = await contract.burnToken(tokenId);
Rest
...args: [tokenId: BigNumberish]Checkout
Create a FIAT currency checkout for your NFT drop.
Claim NFTs to the connected wallet.
Rest
...args: [quantity: BigNumberish, checkERC20Allowance: any]See NFTDrop.claimTo
Rest
...args: [quantity: BigNumberish, checkERC20Allowance: any]Configure claim conditions
Define who can claim NFTs in the collection, when and how many.
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
}
]);
await contract.claimConditions.set(claimConditions);
Claim unique NFTs to a specific Wallet
Rest
...args: [destinationAddress: string, quantity: BigNumberish, checkERC20Allowance: any]Let the specified wallet claim NFTs.
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
Rest
...args: [destinationAddress: string, quantity: BigNumberish, checkERC20Allowance: any]Protected
contractCreate a batch of unique NFTs to be claimed in the future
Rest
...args: [metadatas: (string | objectInputType<{ Create batch allows you to create a batch of many unique NFTs in one transaction.
// 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
Rest
...args: [metadatas: (string | objectInputType<{ Delayed reveal
Create a batch of encrypted NFTs that can be revealed at a later time.
// 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");
Configure royalties
Set your own royalties for the entire contract or per token
// 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..."
});
Protected
storageTransfer an NFT
Rest
...args: [to: string, tokenId: BigNumberish]Transfer an NFT from the connected wallet to another wallet.
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.transfer(walletAddress, tokenId);
Rest
...args: [to: string, tokenId: BigNumberish]Static
contractGet NFT Balance
Get a wallets NFT balance (number of NFTs in this contract owned by the wallet).
const walletAddress = "{{wallet_address}}";
const balance = await contract.balanceOf(walletAddress);
console.log(balance);
Get all NFTs
Optional
queryParams: { optional filtering to only fetch a subset of results.
Optional
count?: numberOptional
start?: numberThe NFT metadata for all NFTs queried.
Get all the data associated with every NFT in this contract.
By default, returns the first 100 NFTs, use queryParams to fetch more.
const nfts = await contract.getAll();
console.log(nfts);
Get All Claimed NFTs
Optional
queryParams: { optional filtering to only fetch a subset of results.
Optional
count?: numberOptional
start?: numberThe NFT metadata and their ownersfor all NFTs queried.
Fetch all the NFTs (and their owners) that have been claimed in this Drop.
const claimedNFTs = await contract.getAllClaimed();
const firstOwner = claimedNFTs[0].owner;
Get All Unclaimed NFTs
Optional
queryParams: { optional filtering to only fetch a subset of results.
Optional
count?: numberOptional
start?: numberThe NFT metadata for all NFTs queried.
Fetch all the NFTs that have been not been claimed yet in this Drop.
const unclaimedNFTs = await contract.getAllUnclaimed();
const firstUnclaimedNFT = unclaimedNFTs[0].name;
Construct a claim transaction without executing it. This is useful for estimating the gas cost of a claim transaction, overriding transaction options and having fine grained control over the transaction execution.
Use contract.erc721.claim.prepare(...args)
instead
Get all NFTs owned by a specific wallet
Optional
walletAddress: stringthe wallet address to query, defaults to the connected wallet
Optional
queryParams: { optional filtering to only fetch a subset of results.
Optional
count?: numberOptional
start?: numberThe NFT metadata for all NFTs in the contract.
Get all the data associated with the 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);
console.log(nfts);
Generated using TypeDoc
Setup a collection of one-of-one NFTs that are minted as users claim them.
Example