Parsing steps:
Make sure nodejs is installed on your machine.
yarn add nft-parser
OR
npm i --save nft-parser
To import the latest version of nft-parser library:
yarn add "git+https://github.com/xp-network/nft-parser#bleeding-edge"
import { nftGeneralParser } from "nft-parser/dist/src/index";
3.1 Example of getting parsed nft object with metadata for nft received from xp.network nft-indexer
{
"uri": "https://nft.xp.network/w/30536082382037290147901655651",
"native": {
"chainId": "12",
"tokenId": "30536082382037290147901655651",
"owner": "0xb6C8748115d23Eb1c6d59Cb83eAe051b56ef75c7",
"contract": "0x0D41c70E20587c2ec1cea9c4A3d394eC63C4bfbe",
"symbol": "RMBB",
"name": "Rocket Monsters Bear Battalion",
"uri": "https://nft.xp.network/w/30536082382037290147901655651",
"contractType": "ERC721"
},
"collectionIdent": "0x0D41c70E20587c2ec1cea9c4A3d394eC63C4bfbe"
}
const parsedObject = await nftGeneralParser(NFT, Address);
interface NFT {
chainId: string;
tokenId: string;
owner: string;
uri: string;
contract: string;
collectionIdent: string;
native: any;
metaData: {
whitelisted: boolean;
image: string;
imageFormat: string;
animation_url?: string;
animation_url_format?: string;
name?: string;
symbol?: string;
attributes?: any;
description?: string;
contractType?: string;
};
}