Socket
Socket
Sign inDemoInstall

nft-parser

Package Overview
Dependencies
11
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nft-parser

<center>


Version published
Weekly downloads
7
decreased by-30%
Maintainers
1
Install size
66.5 MB
Created
Weekly downloads
 

Readme

Source

XP Network NFT-Parser

Work In Progress / Alpha Stage Library


Parsing steps:
  • 1. Installing the library
  • 2. Importing the dependencies
  • 3. Get parsed nft object with metadata


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

FAQs

Last updated on 29 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc