Private
_chainAirdrop multiple NFTs
Rest
...args: [tokenId: BigNumberish, addresses: string[] | { Airdrop one or multiple NFTs to the provided wallet addresses.
// 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.erc1155.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.erc1155.airdrop(tokenId, addresses);
ERC1155BatchTransferable
Rest
...args: [tokenId: BigNumberish, addresses: string[] | { Burn NFTs
Rest
...args: [tokenId: BigNumberish, amount: BigNumberish]Burn the specified NFTs from the connected wallet
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of the NFT you want to burn
const amount = 2;
const result = await contract.erc1155.burn(tokenId, amount);
ERC1155Burnable
Rest
...args: [tokenId: BigNumberish, amount: BigNumberish]Burn a batch of NFTs
Rest
...args: [tokenIds: BigNumberish[], amounts: BigNumberish[]]Burn the batch NFTs from the connected wallet
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];
const result = await contract.erc1155.burnBatch(tokenIds, amounts);
ERC1155Burnable
Rest
...args: [tokenIds: BigNumberish[], amounts: BigNumberish[]]Burn a batch of NFTs from a specific wallet
Rest
...args: [account: string, tokenIds: BigNumberish[], amounts: BigNumberish[]]Burn the batch NFTs from the specified wallet
// The address of the wallet to burn NFTS from
const account = "0x...";
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];
const result = await contract.erc1155.burnBatchFrom(account, tokenIds, amounts);
ERC1155Burnable
Rest
...args: [account: string, tokenIds: BigNumberish[], amounts: BigNumberish[]]Burn NFTs from a specific wallet
Rest
...args: [account: string, tokenId: BigNumberish, amount: BigNumberish]Burn the specified NFTs from a specified wallet
// The address of the wallet to burn NFTS from
const account = "0x...";
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of this NFT you want to burn
const amount = 2;
const result = await contract.erc1155.burnFrom(account, tokenId, amount);
ERC1155Burnable
Rest
...args: [account: string, tokenId: BigNumberish, amount: BigNumberish]Private
burnableClaim NFTs
Rest
...args: [tokenId: BigNumberish, quantity: BigNumberish, options?: ClaimOptions]Let the connected wallet claim 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.erc1155.claim(tokenId, quantity);
const receipt = tx.receipt; // the transaction receipt
ERC1155ClaimCustom | ERC1155ClaimPhasesV2 | ERC1155ClaimPhasesV1 | ERC1155ClaimConditionsV2 | ERC1155ClaimConditionsV1
Rest
...args: [tokenId: BigNumberish, quantity: BigNumberish, options?: ClaimOptions]Private
claimClaim NFTs to a specific Wallet
Rest
...args: [destinationAddress: string, tokenId: BigNumberish, quantity: BigNumberish, options?: ClaimOptions]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.erc1155.claimTo(address, tokenId, quantity);
const receipt = tx.receipt; // the transaction receipt
ERC1155ClaimCustom | ERC1155ClaimPhasesV2 | ERC1155ClaimPhasesV1 | ERC1155ClaimConditionsV2 | ERC1155ClaimConditionsV1
Rest
...args: [destinationAddress: string, tokenId: BigNumberish, quantity: BigNumberish, options?: ClaimOptions]Private
claimProtected
contractLazy mint NFTs
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.erc1155.lazyMint(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
ERC1155LazyMintableV1 | ERC1155LazyMintableV2
Rest
...args: [metadatas: (string | objectInputType<{ Private
lazyMint an NFT
Rest
...args: [metadataWithSupply: { Mint an NFT with a limited supply to the connected 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.erc1155.mint(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
ERC1155Mintable
Rest
...args: [metadataWithSupply: { Increase the supply of an existing NFT
Rest
...args: [tokenId: BigNumberish, additionalSupply: BigNumberish]Increase the supply of an existing NFT and mint it to the connected wallet address
const tokenId = 0;
const additionalSupply = 1000;
await contract.erc1155.mintAdditionalSupply(tokenId, additionalSupply);
ERC1155Mintable
Rest
...args: [tokenId: BigNumberish, additionalSupply: BigNumberish]Increase the supply of an existing NFT and mint it to a given wallet address
Rest
...args: [receiver: string, tokenId: BigNumberish, additionalSupply: BigNumberish]ERC1155Mintable
Rest
...args: [receiver: string, tokenId: BigNumberish, additionalSupply: BigNumberish]Mint multiple NFTs at once
Rest
...args: [metadataWithSupply: { Mint multiple different NFTs with limited supplies to the connected wallet.
// 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.erc1155.mintBatch(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
ERC1155BatchMintable
Rest
...args: [metadataWithSupply: { Mint multiple NFTs at once to a specific wallet
Rest
...args: [receiver: string, metadataWithSupply: { Mint multiple 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.erc1155.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
ERC1155BatchMintable
Rest
...args: [receiver: string, metadataWithSupply: { Mint an NFT to a specific wallet
Rest
...args: [receiver: 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.erc1155.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
ERC1155Mintable
Rest
...args: [receiver: string, metadataWithSupply: { Private
mintablePrivate
querySet approval for all NFTs
Rest
...args: [operator: string, approved: boolean]Approve or remove operator as an operator for the caller. Operators can call transferFrom or safeTransferFrom for any token owned by the caller.
const operator = "{{wallet_address}}";
await contract.erc1155.setApprovalForAll(operator, true);
ERC1155
Rest
...args: [operator: string, approved: boolean]Private
signatureProtected
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.erc1155.transfer(toAddress, tokenId, amount);
ERC1155
Rest
...args: [to: string, tokenId: BigNumberish, amount: BigNumberish, data: BytesLike]Transfer an NFT from a specific wallet
Rest
...args: [from: string, to: string, tokenId: BigNumberish, amount: BigNumberish, data: BytesLike]Transfer an NFT from a specific 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.erc1155.transfer(toAddress, tokenId, amount);
ERC1155
Rest
...args: [from: string, to: string, tokenId: BigNumberish, amount: BigNumberish, data: BytesLike]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.erc1155.claimConditions.set(tokenId, claimConditions);
ERC1155ClaimPhasesV2 | ERC1155ClaimPhasesV1 | ERC1155ClaimConditionsV2 | ERC1155ClaimConditionsV1
Mint delayed reveal NFTs
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.erc1155.drop.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.erc1155.revealer.reveal(batchId, "my secret password");
ERC1155Revealable
Mint with signature
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.erc1155.signature.generate()` documentation
const signedPayload = contract.erc1155.signature().generate(payload);
// now anyone can mint the NFT
const tx = contract.erc1155.signature.mint(signedPayload);
const receipt = tx.receipt; // the mint transaction receipt
const mintedId = tx.id; // the id of the NFT minted
ERC1155SignatureMintable
Get NFT balance of a specific wallet
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.erc1155.balanceOf(walletAddress, tokenId);
ERC1155
Private
detectPrivate
detectPrivate
detectPrivate
detectPrivate
detectPrivate
detectPrivate
detectGet 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.erc1155.getAll();
ERC1155Enumerable
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
options: ClaimOptionsOptional claim verification data (e.g. price, currency, etc...)
Use contract.erc1155.claim.prepare(...args)
instead
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
Use contract.erc1155.mint.prepare(...args)
instead
ERC1155Mintable
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.erc1155.getOwned(address);
ERC1155Enumerable
Get the total number of NFTs minted
the total number of NFTs minted in this contract
This returns the total number of NFTs minted in this contract, not the total supply of a given token.
const count = await contract.erc1155.totalCount();
console.log(count);
ERC1155Enumerable
Generated using TypeDoc
Standard ERC1155 NFT functions
Remarks
Basic functionality for a ERC1155 contract that handles IPFS storage for you.
Example