Get List Collection By Owner
Request
In order to get collections of a wallet on-chain, SDK provides you with a getCollectionsByOwner
endpoint to do so
try {
const bnbContract = nft2Client.getNFT2Contract(56);
const { collections, total } = await bnbContract.getCollectionsByOwner(
"0x...", // user wallet
{
limit: 20,
offset: 0
}
);
console.log(collections, total)
} catch (e) {
console.error(e);
}
Parameters
ownerAddress
(string): Wallet address of owner.- Pagination:
limit
(number): Pagination limit.offset
(number): Pagination offset.sort
({field: 'deployAt'; order: 'DESC' | 'ASC'}
): Optional. Only support sort on collection deploy block. Default order DESC.
chainIds
: Which chains to get from. Optional. Multi Chain only
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;
}