Get List Collection

Request

In order to get collections information on-chain, SDK provides you with a getCollections endpoint to do so

try {
  const mainnetClient = nft2Client.getNFT2ContractMultichain('mainnet');
 
  const { collections, total } = await mainnetClient.getCollections({
    limit: 20,
    offset: 0
  }, 
  [56, 43114]);
 
  console.log(collections, total)
} catch (e) {
  console.error(e);
}

Parameters

  • Pagination:

    • limit (number): Pagination limit.

    • offset (number): Pagination offset.

    • sort ({field: 'deployAt'; order: 'DESC' | 'ASC'}): Optional. Only support sort on collection deploy time. Default order DESC.

  • chainIds: Which chains to get from.

Response

{
  collections: Array<{
    name: string;
    symbol: string;
    imageUrl: string;
    contractAddress: string;
    ownerAddress: string;
    creatorAddress: string;
    chainId: number;
    type: number;
    deployedAt: Date;
    totalNfts: number;
    totalOwners: number;
    kind: number;
    defaultRoyalty: number;
  }>;
  total: number;
}

Last updated