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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nftscan-api

v1.15.0

Published

js/ts SDK for NFTScan APIs

Downloads

352

Readme

NFTScan API SDK (JavaScript / TypeScript)

The NFTScan API SDK is a JavaScript / TypeScript library which provides convenience and quick access to the NFTScan's APIs, it helps developers build new experiences retrieving NFTs and data analysis. We provide a set of endpoints that enable you to fetch ERC721 and ERC1155 NFT assets as well as transactions, collections, marketplace statistics and more.

To use our APIs, You need to register an account on NFTScan open platform OpenAPI Platform and get your API-KEY for making calls to API services.

The SDK currently supports the following chains:

| Blockchain | Domain name | Short name | | ------------ | ----------------------- | ---------- | | Ethereum | restapi.nftscan.com | eth | | BNB chain | bnbapi.nftscan.com | bnb | | Polygon | polygonapi.nftscan.com | polygon | | OP Mainnet | optimismapi.nftscan.com | optimism | | Mint | mintapi.nftscan.com | mint | | Mantle | mantleapi.nftscan.com | mantle | | Base | baseapi.nftscan.com | base | | Sei | seiapi.nftscan.com | sei | | Gravity | gravityapi.nftscan.com | gravity | | Berachain | beraapi.nftscan.com | bera | | Viction | victionapi.nftscan.com | viction | | Solana | solanaapi.nftscan.com | solana |

The value of Short name is used in the SDK as an initialization configuration parameter.

Getting started

via npm:

npm install nftscan-api

or yarn:

yarn add nftscan-api

Then you can import and use the SDK:

import { ErcType, EvmChain, NftscanEvm } from "nftscan-api";

const config = {
  apiKey: "<YOUR_API_KEY>", // Replace with your NFTScan API key.
  chain: EvmChain.ETH, // Replace with your chain.
};

const evm = new NftscanEvm(config);

or

import { ErcType, NftscanEvm } from "nftscan-api";

const config = {
  apiKey: "<YOUR_API_KEY>", // Replace with your NFTScan API key.
  baseUrl: "<HTTPS_URL>" + "/api", // Or replace with a valid https URL.
};

const evm = new NftscanEvm(config);

The new NftscanEvm() returns an object that can query the EVM-like chain, for here it is EvmChain.ETH, which stand for the Ethereum blockchain. It must be ensured that one of the chain or baseUrl attribute is valid. A valid baseUrl supported by NFTSCAN can be found here: EVM chains.

The complete enumeration value of EvmChain includes the following:

export enum EvmChain {
  ETH = 'eth',
  BNB = 'bnb',
  POLYGON = 'polygon',
  OPTIMISM = 'optimism',
  MINT = 'mint',
  MANTLE = 'mantle',
  BASE = 'base',
  SEI = 'sei',
  GRAVITY = 'gravity',
  BERA = 'bera',
  VICTION = 'viction',
}

And then you can use the object evm to access to the NFTScan API, form example getAssetsByAccount, which can retrieve the assets owned by an account.

const accountAddress = "<ACCOUNT_ADDRESS>"; // Replace with the account address you want to query.
// Access asset-related APIs
evm.asset
  // Retrieve assets owned by an account.
  .getAssetsByAccount(accountAddress, {
    erc_type: ErcType.ERC_721, // Can be erc721 or erc1155
  })
  .then((res) => console.log(res));

// Access transaction-related APIs 
evm.transaction
  // Retrieve transactions by an account
  .getTransactionsByAccount(accountAddress)
  .then((res) => console.log(res));

Not only asset and transaction, but the NftscanEvm also provides several other objects, for example collection \ statistic \ other, these objects provide different types of APIs.

To query the other EVM-like chain's asset, for example 'Arbitrum', changing the config param chain to EvmChain.ARBITRUM:

const evm = new NftscanEvm({
  apiKey: "<YOUR_API_KEY>",
  chain: EvmChain.ARBITRUM, 
});

We also support the Solana blockchain, to access the API, you just need to use new NftscanSolana() to get an object.

const sol = new NftscanSolana({ apiKey: "<YOUR_API_KEY>" });
sol.asset
  .getAssetsByAccount("<ACCOUNT_ADDRESS>")
  .then((res) => console.log(res));

Pagination

In general, NFTScan's API that supports pagination will uses the query params cursor as the paging parameter, The return data of the API call will contain the attribute next, you can pass in the next value to the next call.

For example:

let nextCursor = "";
const { content, next } = await evm.asset.getAccountMinted("<ACCOUNT_ADDRESS>", {
  cursor: nextCursor, // A cursor to retrieve the next page
  limit: 20, // Page size
});
// update the nextCursor
nextCursor = next;

API

The SDK currently supports all of the NFTScan API endpoints, The distribution of the API is consistent with the NFTScan API.

As follows:

More