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.

var data = await contract.ERC1155.Balance("{{token_id}}");
Configuration

tokenId

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

Must be a string.

Return Value

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

string

BalanceOf

Get the quantity of a specific NFT owned by a wallet.

var data = await contract.ERC1155.BalanceOf("{{wallet_address}}", "{{token_id}}");
Configuration

address

The wallet address to check the NFT balance for.

Must be a string.

tokenId

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

Must be a string.

Return Value

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

string

Get

Get the metadata of an NFT using its 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 objects image property will be a URL that is available through the thirdweb IPFS gateway.

var data = await contract.ERC1155.Get("{{token_id}}");
Configuration

tokenId

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

Must be a string.

Return Value

Returns an NFT struct containing the following properties:

{
{
string id;
string uri;
string description;
string image;
string name;
string external_url;
object attributes;
}
string owner;
string type;
int supply;
int quantityOwned; // only for ERC1155
}

Transfer

Transfer an NFT from the connected wallet to another wallet.

var data = await contract.ERC1155.Transfer("{{wallet_address}}", "{{token_id}}", 1);
Configuration

to

The wallet address to send the NFT to.

Must be a string.

tokenId

The token ID of the NFT to transfer.

Must be a string.

amount

The quantity of the NFT to transfer.

Must be an int.

IsApprovedForAll

Get whether this wallet has approved transfers from the given operator.

This means that the operator can transfer NFTs on behalf of this wallet.

var data = await contract.ERC1155.IsApprovedForAll("{{owner_address}}", "{{operator_address}}");
Configuration

owner

The wallet address that owns the NFT.

Must be a string.

operator

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

Must be a string.

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.

var data = await contract.ERC1155.SetApprovalForAll("{{operator_address}}", true);
Configuration

operator

The wallet address to approve.

Must be a string.

approved

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

Must be a bool.

TotalCount

Get the total number of unique NFTs in the collection.

var data = await contract.ERC1155.TotalCount();
Configuration

Return Value

Returns an int representing the total number of unique NFTs in the collection.

int

TotalSupply

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

var data = await contract.ERC1155.TotalSupply("{{token_id}}");
Configuration

tokenId

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

Must be a string.

Return Value

Returns an int representing the total supply of the token.

int