Skip to main content

ERC1155Enumerable

Functionality available for contracts that implement the IERC1155Enumerable interface.

Metadata for each NFT is fetched from the NFTs uri property.

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.

getAll

Get the metadata and current owner of all NFTs in the contract.

By default, returns the first 100 NFTs (in order of token ID). Use queryParams to paginate the results.

const nfts = await contract.erc1155.getAll();
Configuration

queryParams (optional)

Provide an optional object to configure the query. Useful for paginating the results.

const queryParams = {
// The number of NFTs to return
count: 100, // Default is 100
// The index to start from
start: 0, // Default is 0
};

const nfts = await contract.erc1155.getAll(queryParams);

Return Value

Returns an array of NFT objects 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;
};
type: "ERC1155";
}[]

getOwned

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);
Configuration

address

The address of the wallet to get the NFTs of.

Must be a string.

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

Return Value

Returns an array of NFT objects 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;
};
type: "ERC1155";
}[]