Skip to main content

Get collection data

A collection is a deployed ERC721 smart contract that is used to mint an in-game assets (i.e. NFTs). You can get a list of deployed collections on a specific chain, for a particular NFT owner account address, or the details of a specific collection.

Get collection dataGet collection data

Request parameters

ParameterDescriptionRequired
chainNameString representing the name of the chain. A list of available chains can be found here.Yes
accountAddressThe public key of a wallet holding NFTs; mandatory for owner-based requestsNo
contractAddressOptional list of contract addresses to retrieve only a subset of collectionsNo
Pagination parametersParameters such as page_size and page_cursor that allow you to control the size and order of the data retrievedNo

List collections on a specific chain

This request returns a list of collections deployed on a user specified chain, including on and off-chain metadata.

listCollections.tsView on GitHub
import { blockchainData } from "@imtbl/sdk";
import { client } from "../lib";

export async function listCollections(
chainName: string
): Promise<blockchainData.Types.ListCollectionsResult> {
return await client.listCollections({
chainName,
});
}

Example response

[
{
"result": {
"chain": {
"id": "eip155:13473",
"name": "imtbl-zkevm-testnet"
},
"name": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"symbol": "BASP",
"contract_type": "ERC721",
"contract_address": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"description": "Some description",
"image": "https://some-url",
"external_link": "https://some-url",
"contract_uri": "https://some-url",
"base_uri": "https://some-url",
"indexed_at": "2022-08-16T17:43:26.991388Z",
"updated_at": "2022-08-16T17:43:26.991388Z",
"last_metadata_synced_at": "2022-08-16T17:43:26.991388Z"
}
}
]

List collections by NFT owner

This request returns a list of collections deployed on a user specified chain, according to the NFT's that an account address owns.

listCollectionsByOwner.tsView on GitHub
import { blockchainData } from "@imtbl/sdk";
import { client } from "../lib";

export async function listCollectionsByNFTOwner(
chainName: string,
accountAddress: string
): Promise<blockchainData.Types.ListCollectionsResult> {
return await client.listCollectionsByNFTOwner({
chainName,
accountAddress,
});
}

Example response

[
{
"result": {
"chain": {
"id": "eip155:13473",
"name": "imtbl-zkevm-testnet"
},
"name": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"symbol": "BASP",
"contract_type": "ERC721",
"contract_address": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"description": "Some description",
"image": "https://some-url",
"external_link": "https://some-url",
"contract_uri": "https://some-url",
"base_uri": "https://some-url",
"indexed_at": "2022-08-16T17:43:26.991388Z",
"updated_at": "2022-08-16T17:43:26.991388Z",
"last_metadata_synced_at": "2022-08-16T17:43:26.991388Z"
}
}
]

Get the details of a single collection

This request allows you to get details of a specific collection.

getCollection.tsView on GitHub
import { blockchainData } from '@imtbl/sdk';

import { client } from '../lib';

export async function getCollection(
contractAddress: string,
): Promise<blockchainData.Types.GetCollectionResult> {
return await client.getCollection({
chainName: 'imtbl-zkevm-testnet',
contractAddress,
});
};

Example response

{
"result": {
"chain": {
"id": "eip155:13473",
"name": "imtbl-zkevm-testnet"
},
"name": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"symbol": "BASP",
"contract_type": "ERC721",
"contract_address": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"description": "Some description",
"image": "https://some-url",
"external_link": "https://some-url",
"contract_uri": "https://some-url",
"base_uri": "https://some-url",
"indexed_at": "2022-08-16T17:43:26.991388Z",
"updated_at": "2022-08-16T17:43:26.991388Z",
"last_metadata_synced_at": "2022-08-16T17:43:26.991388Z"
}
}
💡Where is NFT metadata hosted?

When an asset is minted, its metadata is cached by Immutable's blockchain data indexer, making it accessible via the the Blockchain Data APIs.

When an NFT's metadata is updated, requesting a "metadata refresh" updates the cached information to ensure that changes are available via the API.