Skip to content

XP-NETWORK/nft-parser

Repository files navigation

XP Network NFT-Parser

Work In Progress / Alpha Stage Library


Parsing steps:


To parse NFTs metadata, follow the steps below:


Make sure nodejs is installed on your machine.

1. Install the libraries required for the project:


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"

2. Import the dependencies

import { nftGeneralParser } from "nft-parser/dist/src/index";


3. Get parsed nft object with metadata

3.1 Example of getting parsed nft object with metadata for nft received from xp.network nft-indexer

NFT

{
    "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"
}

Address - wallet address your dApp connected to

const parsedObject = await nftGeneralParser(NFT, Address);

Returned parsed object

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;
    };
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •