Get List NFT By Collection
Request
In order to get list NFT of a collection, SDK provides you with a getNFTsByCollection
endpoint to do so
try {
const bnbContract = nft2Client.getNFT2Contract(56);
const { nfts, total } = await bnbContract.getNFTsByCollection(
"0x...", // collection address
{
limit: 20,
offset: 0
}
);
console.log(nfts, total)
} catch (e) {
console.error(e);
}
Parameters
chainId
: Which chain to get from. Multi Chain onlycollectionAddress
(string): Collection contract address.- Pagination:
limit
(number): Pagination limit.offset
(number): Pagination offset.sort
({field: 'tokenId' | 'mintedAt'; order: 'DESC' | 'ASC'}
): Optional. Default order ASC by tokenId.
Response
{
nfts: Array<{
name: string;
description: string;
tokenId: string;
chainId: number;
creatorAddress: string;
ownerAddress: string;
imageUrl: string;
tokenUri: string;
type: number;
status: number;
mintedAt: Date;
royalties: number;
collection: Collection;
}>;
total: number;
}