Get NFT Info
Request
In order to get a NFT info on-chain, SDK provides you with a getNFTInfo
endpoint to do so
try {
const bnbContract = nft2Client.getNFT2Contract(56);
const { nft, derivedAccount } = await bnbContract.getNFTInfo(
"0x...", // collection address
"123", // token id
);
console.log(nft, derivedAccount)
} catch (e) {
console.error(e);
}
Parameters
chainId
: Which chain to get from. Multi Chain onlycollectionAddress
(string): Collection contract address.tokenId
(string): NFT token ID.
Response
{
nft: {
name: string;
description: string;
tokenId: string;
chainId: number;
creatorAddress: string;
ownerAddress: string;
imageUrl: string;
tokenUri: string;
type: number;
status: number;
mintedAt: Date;
attributes: any[];
openAt?: Date;
closeAt?: Date;
royalties?: number;
collection: Collection;
original?: {
collectionAddress: string;
tokenId: string;
};
dataRegistry?: DataRegistry;
};
derivedAccount: string | null;
}