npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nft_contract_reader

v1.0.2

Published

This script is a command-line tool for interacting with NFT contracts, designed to handle token ID validation and metadata retrieval. It supports both ERC-721 and ERC-1155 contracts and can connect to various Ethereum networks.

Downloads

8

Readme

NFT Contract Reader - With Token ID Validation

This script is a command-line tool for interacting with NFT contracts, designed to handle token ID validation and metadata retrieval. It supports both ERC-721 and ERC-1155 contracts and can connect to various Ethereum networks.

Key Features

  • Network Support: Connect to Ethereum Mainnet, Polygon, Optimism, Arbitrum, Base, Goerli, Sepolia, and MegaEther test networks. (can add custom network)
  • Contract Setup: Creates contract instances with enhanced ABIs for ERC-721 and ERC-1155 contracts.
  • Token ID Discovery: Discovers valid token IDs using common patterns and sequential search.
  • Metadata Fetching: Fetches metadata from various token URI formats, including data URIs, HTTP URLs, and IPFS URLs.
  • Unminted Token Handling: Provides options to handle and fetch information about unminted tokens.

Dependencies

  • node-fetch: For making HTTP requests.
  • fs: For file system operations.
  • readline: For reading input from the console.
  • ethers: For interacting with Ethereum contracts.
  • dotenv: For loading environment variables from a .env file.

Setup

  1. Environment Variables: Create a .env file in the project directory and add the following environment variables:

    ETH_MAINNET_URL=YOUR_ETH_MAINNET_RPC_URL
    POLYGON_MAINNET_URL=YOUR_POLYGON_MAINNET_RPC_URL
    OPTIMISM_MAINNET_URL=YOUR_OPTIMISM_MAINNET_RPC_URL
    ARBITRUM_MAINNET_URL=YOUR_ARBITRUM_MAINNET_RPC_URL
    BASE_MAINNET_URL=YOUR_BASE_MAINNET_RPC_URL
    ETH_GOERLI_URL=YOUR_ETH_GOERLI_RPC_URL
    ETH_SEPOLIA_URL=YOUR_ETH_SEPOLIA_RPC_URL
    MEGAETHER_TESTNET_URL=YOUR_MEGAETHER_TESTNET_RPC_URL

    Replace YOUR_*_RPC_URL with the actual RPC URLs for the respective networks. You can obtain these URLs from services like Infura, Alchemy, or QuickNode.

    Important Security Note: Be extremely cautious about storing your private key or other sensitive information directly in environment variables or in your code. It is recommended to use secure methods for managing sensitive information, such as a dedicated secrets management system. Ensure that your .env file is properly secured and is NOT committed to version control (e.g., by adding it to your .gitignore file).

  2. Install Dependencies:

    Run the following command in the project directory to install the required dependencies:

    npm install node-fetch ethers dotenv

Usage

  1. Run the Script:

    Execute the script using Node.js:

    node ipfs.js
  2. Select a Network:

    The script will prompt you to select a network from the list of available networks. Enter the corresponding number to select a network.

  3. Enter Contract Address:

    Enter the address of the NFT contract you want to interact with.

  4. Select a Token ID:

    The script will attempt to discover valid token IDs. You can then:

    • Select a token ID from the list of discovered tokens.
    • Enter a custom token ID.
    • Select an unminted token ID (if available).
  5. View Metadata:

    The script will fetch and display the metadata associated with the selected token ID. It will also provide a link to view the token on the blockchain explorer.

Error Handling and Troubleshooting

  • Invalid Contract Address: Ensure that the contract address is valid and that a contract exists at that address.
  • Network Connection Errors: Check your internet connection and verify that the RPC URLs are correct.
  • Token ID Not Found: If the script cannot find a valid token ID, try using a custom token ID or check the contract's documentation for the correct token ID format.
  • Metadata Fetching Errors: If the script fails to fetch metadata, check the token URI and ensure that it is accessible and returns valid JSON data.

Contact

If you have any questions or issues, please contact [Your Name/Email] or open an issue on the project's GitHub repository.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

LEAVE ME A STAR

BUY A COFFEE

EVM:

0x3DCf20ff09dbCb97C3b14CD5C3b9963c4416915a

BTC:

32ksT1FnGXdF7VF8rcYhoU6ohTBDXzkwBr

TRON:

TSpp1HPNkyvtqzBZDy1QVm9t1oFxe9hZuB