Skip to main content

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

tokenId​

The token ID of the NFT to check the balance of.

Must be a string, number, or BigNumber.

const balance = await contract.erc1155.balanceOf(
"{{token_id}}",
);

Return Value​

A BigNumber representing the quantity of the NFT owned by the wallet.

BigNumber;

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

address​

The wallet address to check the NFT balance for.

Must be a string.

const balance = await contract.erc1155.balanceOf(
"{{wallet_address}}",
"{{token_id}}",
);

tokenId​

The token ID of the NFT to check the balance of.

const balance = await contract.erc1155.balanceOf(
"{{wallet_address}}",
"{{token_id}}",
);

Return Value​

A BigNumber representing the quantity of the NFT owned by the wallet.

BigNumber;

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

tokenId​

The token ID of the NFT to get the metadata for.

Must be a string, number, or BigNumber.

const nft = await contract.erc1155.get(
"{{token_id}}",
);

Return Value​

Returns an NFT object containing the following properties:

{
metadata: {
id: string;
uri: string; // The raw URI of the metadata
owner: string;
name?: string | number | undefined;
description?: string | null | undefined;
image?: string | null | undefined; // If the image is hosted on IPFS, the URL is https://gateway.ipfscdn.io/ipfs/<hash>
external_url?: string | null | undefined;
animation_url?: string | null | undefined;
background_color?: string | undefined;
properties?: {
[x: string]: unknown;
} | {
[x: string]: unknown;
}[] | undefined;
};
owner: string;
type: "ERC1155";
supply: number;
quantityOwned?: number;
}

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

to​

The wallet address to send the NFT to.

Must be a string.

await contract.erc1155.transfer(
"{{wallet_address}}",
"{{token_id}}",
"{{amount}}",
);

tokenId​

The token ID of the NFT to transfer.

Must be a string, number, or BigNumber.

await contract.erc1155.transfer(
"{{wallet_address}}",
"{{token_id}}",
"{{amount}}",
);

amount​

The quantity of the NFT to transfer.

Must be a string, number, or BigNumber.

await contract.erc1155.transfer(
"{{wallet_address}}",
"{{token_id}}",
"{{amount}}",
);

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

tokenId​

The token ID of the NFT to transfer.

Must be a string, number, or BigNumber.

const txResult = await contract.erc1155.airdrop(
"{{token_id}}",
[
// ...
],
);

addresses​

An array of objects containing address and quantity properties.

These are the recipients of the airdrop.

const txResult = await contract.erc1155.airdrop("{{token_id}}", [
{
address: "{{wallet_address}}",
quantity: 1,
},
{
address: "{{wallet_address}}",
quantity: 2,
},
]);

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

owner​

The wallet address that owns the NFT.

Must be a string.

const isApproved = await contract.erc1155.isApproved(
"{{wallet_address}}",
"{{wallet_address}}",
);

operator​

The wallet address of the operator to check (i.e. the wallet that does/does not have approval).

Must be a string.

const isApproved = await contract.erc1155.isApproved(
"{{wallet_address}}",
"{{wallet_address}}",
);

setApprovalForAll​

Give another address approval (or remove approval) to transfer all of your NFTs from this collection.

Warning

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

operator​

The wallet address to approve.

Must be a string.

const txResult = await contract.erc1155.setApprovalForAll(
"{{wallet_address}}",
true,
);

approved​

Whether to grant approval (true) or remove approval (false).

Must be a boolean.

const txResult = await contract.erc1155.setApprovalForAll(
"{{wallet_address}}",
true,
);

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

tokenId​

The token ID of the NFT to get the total circulating supply of.

Must be a string, number, or BigNumber.

const totalCirculatingSupply = await contract.erc1155.totalCirculatingSupply(
"{{token_id}}",
);

Return Value​

Returns a BigNumber representing the total circulating supply of the token.

BigNumber;

totalCount​

Get the total number of unique NFTs in the collection.

const totalCount = await contract.erc1155.totalCount();

Return Value​

Returns a BigNumber representing the total number of unique NFTs in the collection.

BigNumber;

totalSupply​

Returns the total supply of a token in the collection, including burned tokens.

const totalSupply = await contract.erc1155.totalSupply("{{token_id}}");
Configuration

tokenId​

The token ID of the NFT to get the total supply of.

const totalSupply = await contract.erc1155.totalSupply(
"{{token_id}}",
);

Return Value​

Returns a BigNumber representing the total supply of the token.

BigNumber;