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]Protected
contractMint NFT for the connected wallet
Rest
...args: [metadataWithSupply: { See Edition.mintTo
Rest
...args: [metadataWithSupply: { Increase the supply of an existing NFT and mint it to the connected wallet
Rest
...args: [tokenId: BigNumberish, additionalSupply: BigNumberish]Rest
...args: [tokenId: BigNumberish, additionalSupply: BigNumberish]Increase the supply of an existing NFT and mint it to a given wallet address
Rest
...args: [to: string, tokenId: BigNumberish, additionalSupply: BigNumberish]Rest
...args: [to: string, tokenId: BigNumberish, additionalSupply: BigNumberish]Mint Many NFTs for the connected wallet
Rest
...args: [metadatas: { Rest
...args: [metadatas: { Mint Many NFTs with limited supplies
Rest
...args: [to: string, metadataWithSupply: { Mint many different NFTs with limited supplies to a specified wallet.
// Address of the wallet you want to mint the NFT to
const toAddress = "{{wallet_address}}"
// Custom metadata and supplies of your NFTs
const metadataWithSupply = [{
supply: 50, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
},
}, {
supply: 100,
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
},
}];
const tx = await contract.mintBatchTo(toAddress, metadataWithSupply);
const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
const firstTokenId = tx[0].id; // token id of the first minted NFT
const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
Rest
...args: [to: string, metadataWithSupply: { Mint an NFT with a limited supply
Rest
...args: [to: string, metadataWithSupply: { Mint an NFT with a limited supply to a specified wallet.
// Address of the wallet you want to mint the NFT to
const toAddress = "{{wallet_address}}"
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}
const metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
}
const tx = await contract.mintTo(toAddress, metadataWithSupply);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT
Rest
...args: [to: string, metadataWithSupply: { 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..."
});
Signature Minting
Generate dynamic NFTs with your own signature, and let others mint them using that signature.
// 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
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
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 mint transaction without executing it. This is useful for estimating the gas cost of a mint transaction, overriding transaction options and having fine grained control over the transaction execution.
Address you want to send the token to
The metadata of the NFT you want to mint
contract.mint.prepare(...args)
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
Create a collection of NFTs that lets you mint multiple copies of each NFT.
Example