Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
nftscan-api
Advanced tools
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 |
Moonbeam | moonbeamapi.nftscan.com | moonbeam |
Arbitrum One | arbitrumapi.nftscan.com | arbitrum |
OP Mainnet | optimismapi.nftscan.com | optimism |
zkSync Era | zksyncapi.nftscan.com | zksync |
Linea | lineaapi.nftscan.com | linea |
Base | baseapi.nftscan.com | base |
PlatON | platonapi.nftscan.com | platon |
Avalanche-C | avaxapi.nftscan.com | avalanche |
Cronos | cronosapi.nftscan.com | cronos |
Fantom | fantomapi.nftscan.com | fantom |
Gnosis | gnosisapi.nftscan.com | gnosis |
Viction | victionapi.nftscan.com | viction |
Starknet | starknetapi.nftscan.com | starknet |
Mantle | mantleapi.nftscan.com | mantle |
Blast | blastapi.nftscan.com | blast |
Solana | solanaapi.nftscan.com | solana |
The value of Short name is used in the SDK as an initialization configuration parameter.
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',
ARBITRUM = 'arbitrum',
OPTIMISM = 'optimism',
ZKSYNC = 'zksync',
LINEA = 'linea',
Base = 'base',
AVALANCHE = 'avalanche',
MOONBEAM = 'moonbeam',
PLATON = 'platon',
CRONOS = 'cronos',
FANTOM = 'fantom',
GNOSIS = 'gnosis',
VICTION = 'viction',
STARKNET = 'starknet',
}
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));
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;
The SDK currently supports all of the NFTScan API endpoints, The distribution of the API is consistent with the NFTScan API.
As follows:
new NftscanEvm().asset.*
)getAssetsByAccount()
: Get NFTs by accountgetAllAssets()
: Get all NFTs by accountgetAccountMinted()
: Get minted NFTs by accountgetAssetsByContract()
: Get NFTs by contractgetAssetsByContractAndTokenId()
: Get single NFTqueryAssetsInBatches
: Get multiple NFTsqueryAssetsByFilters()
: Search NFTs.queryAssetsByAttributes()
: Get NFTs by attributesgetMultiChainAssets()
: Get all multi-chain NFTs by accountnew NftscanEvm().transaction.*
)getTransactionsByAccount()
: Get transactions by accountgetTransactionsByContract()
: Get transactions by contractgetTransactionsByContractAndTokenId()
: Get transactions by NFTqueryTransactionsByFilters()
: Search transactionsgetTransactionsByToAddress()
: Get transactions by to addressqueryTransactionsByTxHashList()
: Get transactions by hashnew NftscanEvm().collection.*
)getCollectionsByContract()
: Get an NFT collectionqueryCollectionsByFilters()
: Search NFT collectionsqueryCollectionsByAccountAddress()
: Get NFT collections by accountgetCollectionsByRanking()
: Get NFT collections by rankingnew NftscanEvm().statistic.*
)getTradeRanking()
: Trade rankinggetMintRanking()
: mint rankinggetMintAmount()
: Mint amountgetTradersRanking()
: Traders rankinggetGasRanking()
: Gas rankinggetCollectionRanking()
: Collection rankinggetMarketplaceRanking()
: Marketplace rankinggetMarketCapRanking()
: Market cap rankinggetCollectionStatistics()
: Collection statisticsgetCollectionTrade()
: Collection trade distributiongetCollectionTrending()
: Collection trending statisticsgetBlueChipStatistics()
: Blue chipgetAccountOverview()
: Account overviewgetCollectionOverview()
: Collection overviewgetWalletRanking()
: Wallet RankinggetTradeWalletRanking()
: Wallet Trade RankinggetCollectionHoldingAmountDistribution()
: Collection Holding Amount DistributiongetCollectionHoldingPeriodDistribution()
: Collection Holding Period DistributiongetCollectionBlueChipList()
: Collection Blue Chip ListgetAccountHoldingDistribution()
: Account Holding DistributiongetCollectionTopHolder()
: Collection Top Holdernew NftscanEvm().refresh.*
)refreshAsset()
: Refresh an assetrefreshContract()
:Refresh a contractnew NftscanEvm().other.*
)getBlockNumber()
: Get latest block numberqueryAssestAmountByAccounts()
: Get NFT amount by accountgetAssetOwnerByContract()
: Get NFT owners by contractgetAssetOwnerByContractAndTokenId()
: Asset owner amount for an assetnew NftscanSolana().asset.*
)getAssetsByAccount()
: Get NFTs by accountgetAllAssets()
: Get all NFTs by accountgetAccountMinted()
: Get minted NFTs by accountgetAssetsByCollection()
: Get NFTs by collectiongetAssetsByTokenAddress()
: Get single NFTqueryAssetsInBatches
: Get multiple NFTsnew NftscanSolana().transaction.*
)getTransactionsByAccount()
: Get transactions by accountgetTransactionsByCollection()
: Get transactions by collectiongetTransactionsByTokenAddress()
: Get transactions by NFTnew NftscanSolana().collection.*
)getCollection()
: Get an NFT collectionqueryCollectionsByFilters()
: Search NFT collectionsnew NftscanSolana().statistic.*
)getTradeRanking()
: Trade rankinggetCollectionStatistics()
: Collection Statisticsnew NftscanSolana().refresh.*
)refreshAsset()
: Refresh an assetFAQs
js/ts SDK for NFTScan APIs
The npm package nftscan-api receives a total of 155 weekly downloads. As such, nftscan-api popularity was classified as not popular.
We found that nftscan-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.