Airdrop multiple NFTs
Rest
...args: [tokenId: BigNumberish, addresses: string[] | { Airdrop one or multiple NFTs to the provided wallet addresses.
ERC1155
// The token ID of the NFT you want to airdrop
const tokenId = "0";
// Array of objects of addresses and quantities to airdrop NFTs to
const addresses = [
{
address: "0x...",
quantity: 2,
},
{
address: "0x...",
quantity: 3,
},
];
await contract.airdrop(tokenId, addresses);
// You can also pass an array of addresses, it will airdrop 1 NFT per address
const tokenId = "0";
const addresses = [
"0x...", "0x...", "0x...",
]
await contract.airdrop(tokenId, addresses);
Rest
...args: [tokenId: BigNumberish, addresses: string[] | { Burn a specified amount of a NFT
Rest
...args: [tokenId: BigNumberish, amount: BigNumberish]const result = await contract.burnTokens(tokenId, amount);
Rest
...args: [tokenId: BigNumberish, amount: BigNumberish]Checkout
Create a FIAT currency checkout for your NFT drop.
Claim a token to the connected wallet
Rest
...args: [tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance: any]Rest
...args: [tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance: any]Configure claim conditions for each NFT
Define who can claim each NFT in the edition, 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
}
]);
const tokenId = 0; // the id of the NFT to set claim conditions on
await contract.claimConditions.set(tokenId, claimConditions);
Claim NFTs to a specific Wallet
Rest
...args: [destinationAddress: string, tokenId: BigNumberish, 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 tokenId = 0; // the id of the NFT you want to claim
const quantity = 1; // how many NFTs you want to claim
const tx = await contract.claimTo(address, tokenId, quantity);
const receipt = tx.receipt; // the transaction receipt
Rest
...args: [destinationAddress: string, tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance: any]Protected
contractCreate a batch of NFTs to be claimed in the future
Rest
...args: [metadatas: (string | objectInputType<{ Create batch allows you to create a batch of many 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<{ 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, amount: BigNumberish, data: BytesLike]Transfer an NFT from the connected wallet to another wallet.
// Address of the wallet you want to send the NFT to
const toAddress = "{{wallet_address}}";
const tokenId = "0"; // The token ID of the NFT you want to send
const amount = 3; // How many copies of the NFTs to transfer
await contract.transfer(toAddress, tokenId, amount);
Rest
...args: [to: string, tokenId: BigNumberish, amount: BigNumberish, data: BytesLike]Static
Private
contractGet NFT Balance
Get a wallets NFT balance (number of NFTs in this contract owned by the wallet).
// Address of the wallet to check NFT balance
const walletAddress = "{{wallet_address}}";
const tokenId = 0; // Id of the NFT to check
const balance = await contract.balanceOf(walletAddress, tokenId);
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();
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.
Address you want to send the token to
Id of the token you want to claim
Quantity of the tokens you want to claim
Optional, check if the wallet has enough ERC20 allowance to claim the tokens, and if not, approve the transfer
Use contract.erc1155.claim.prepare(...args)
instead
Get all NFTs owned by a specific wallet
Optional
walletAddress: stringOptional
queryParams: { 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);
Generated using TypeDoc
Setup a collection of NFTs with a customizable number of each NFT that are minted as users claim them.
Example