ERC1155
Functionality available for contracts that implement the IERC1155
interface.
balance
Get the quantity of a specific NFT owned by the connected wallet.
const tokenId = 0; // Id of the NFT to check
const balance = await contract.erc1155.balanceOf(tokenId);
Configuration
balanceOf
Get the quantity of a specific NFT owned by a 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);
Configuration
get
Get the metadata of an NFT using it’s token ID.
Metadata is fetched from the uri
property of the NFT.
If the metadata is hosted on IPFS, the metadata is fetched and made available as an object.
The object’s image
property will be a URL that is available through the thirdweb IPFS gateway.
const nft = await contract.erc1155.get(0);
Configuration
transfer
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);
Configuration
airdrop
Transfer NFTs from the connected wallet to multiple different wallets at once.
const txResult = await contract.erc1155.airdrop(
// Token ID of the NFT to transfer
"{{token_id}}",
// Array of wallet addresses to transfer to
[
{
address: "{{wallet_address}}", // Wallet address to transfer to
quantity: 1, // Quantity of the NFT to transfer
},
{
address: "{{wallet_address}}", // Wallet address to transfer to
quantity: 2, // Quantity of the NFT to transfer
},
],
);
Configuration
isApproved
Get whether this wallet has approved transfers from the given operator.
This means that the operator can transfer NFTs on behalf of this wallet.
const isApproved = await contract.erc1155.isApproved(
// Address of the wallet to check
"{{wallet_address}}",
// Address of the operator to check
"{{wallet_address}}",
);
Configuration
setApprovalForAll
Give another address approval (or remove approval) to transfer all of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
const txResult = await contract.erc1155.setApprovalForAll(
// Address of the wallet to approve
"{{wallet_address}}",
// Whether to grant approval (true) or remove approval (false)
true,
);
Configuration
totalCirculatingSupply
Get the total circulating supply of a token in the collection.
Circulating supply considers NFTs that have not been burned.
const totalCirculatingSupply = await contract.erc1155.totalCirculatingSupply(
"{{token_id}}",
);
Configuration
totalSupply
Returns the total supply of a token in the collection, including burned tokens.
const totalSupply = await contract.erc1155.totalSupply("{{token_id}}");