Skip to content

Commit

Permalink
feat:
Browse files Browse the repository at this point in the history
- added endpoint:
  - `getWalletRanking`,
  - `getTradeWalletRanking`,
  - `getCollectionHoldingAmountDistribution`,
  - `getCollectionHoldingPeriodDistribution`,
  - `getCollectionBlueChipList`,
  - `getAccountHoldingDistribution`
- Update the input and output parameters of EVM-related interfaces
- Remove the PRO tag and start using Compute Unit Pricing for all interfaces
  • Loading branch information
yohuohuohuo committed Jun 27, 2023
1 parent fc61b29 commit 340db9c
Show file tree
Hide file tree
Showing 17 changed files with 537 additions and 162 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ dist

#rollup
.rpt2_cache

toTsEntity.js
70 changes: 37 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ The NFTScan API SDK is a `JavaScript` / `TypeScript` library which provides conv

To use our APIs, You need to register an account on NFTScan open platform [OpenAPI Platform](https://developer.nftscan.com) and get your `API-KEY` for making calls to API services.

The daily request limit for a single account is 10,000 general calls. If you have more needs, please upgrade your API plans to [OpenAPI Pricing](https://developer.nftscan.com/payment/pricing) to enhance the number of calls and obtain access to the PRO interfaces.

The SDK currently supports the following chains:

| Blockchain | Domain name | Short name |
Expand Down Expand Up @@ -130,67 +128,73 @@ As follows:
- `getAssetsByAccount()`: [Get NFTs by account](https://docs.nftscan.com/reference/evm/get-nfts-by-account)
- `getAllAssets()`: [Get all NFTs by account](https://docs.nftscan.com/reference/evm/get-all-nfts-by-account)
- `getAccountMinted()`: [Get minted NFTs by account](https://docs.nftscan.com/reference/evm/get-minted-nfts-by-account)
- ***[PRO]*** `getAssetsByContract()`: [Get NFTs by contract](https://docs.nftscan.com/reference/evm/get-nfts-by-contract)
- `getAssetsByContract()`: [Get NFTs by contract](https://docs.nftscan.com/reference/evm/get-nfts-by-contract)
- `getAssetsByContractAndTokenId()`: [Get single NFT](https://docs.nftscan.com/reference/evm/get-single-nft)
- ***[PRO]*** `queryAssetsInBatches`: [Get multiple NFTs](https://docs.nftscan.com/reference/evm/get-multiple-nfts)
- ***[PRO]*** `queryAssetsByFilters()`: [Search NFTs](https://docs.nftscan.com/reference/evm/search-nfts).
- ***[PRO]*** `queryAssetsByAttributes()`: [Get NFTs by attributes](https://docs.nftscan.com/reference/evm/get-nfts-by-attributes)
- ***[PRO]*** `getMultiChainAssets()`: [Get all multi-chain NFTs by account](https://docs.nftscan.com/reference/evm/get-all-multi-chain-nfts-by-account)
- `queryAssetsInBatches`: [Get multiple NFTs](https://docs.nftscan.com/reference/evm/get-multiple-nfts)
- `queryAssetsByFilters()`: [Search NFTs](https://docs.nftscan.com/reference/evm/search-nfts).
- `queryAssetsByAttributes()`: [Get NFTs by attributes](https://docs.nftscan.com/reference/evm/get-nfts-by-attributes)
- `getMultiChainAssets()`: [Get all multi-chain NFTs by account](https://docs.nftscan.com/reference/evm/get-all-multi-chain-nfts-by-account)
- ##### Retrieve Transactions (`new NftscanEvm().transaction.*`)
- ***[PRO]*** `getTransactionsByAccount()`: [Get transactions by account](https://docs.nftscan.com/reference/evm/get-transactions-by-account)
- ***[PRO]*** `getTransactionsByContract()`: [Get transactions by contract](https://docs.nftscan.com/reference/evm/get-transactions-by-contract)
- ***[PRO]*** `getTransactionsByContractAndTokenId()`: [Get transactions by NFT](https://docs.nftscan.com/reference/evm/get-transactions-by-nft)
- ***[PRO]*** `queryTransactionsByFilters()`: [Search transactions](https://docs.nftscan.com/reference/evm/search-transactions)
- ***[PRO]*** `getTransactionsByToAddress()`: [Get transactions by to address](https://docs.nftscan.com/reference/evm/get-transactions-by-to-address)
- ***[PRO]*** `queryTransactionsByTxHashList()`: [Get transactions by hash](https://docs.nftscan.com/reference/evm/get-transactions-by-hash)
- `getTransactionsByAccount()`: [Get transactions by account](https://docs.nftscan.com/reference/evm/get-transactions-by-account)
- `getTransactionsByContract()`: [Get transactions by contract](https://docs.nftscan.com/reference/evm/get-transactions-by-contract)
- `getTransactionsByContractAndTokenId()`: [Get transactions by NFT](https://docs.nftscan.com/reference/evm/get-transactions-by-nft)
- `queryTransactionsByFilters()`: [Search transactions](https://docs.nftscan.com/reference/evm/search-transactions)
- `getTransactionsByToAddress()`: [Get transactions by to address](https://docs.nftscan.com/reference/evm/get-transactions-by-to-address)
- `queryTransactionsByTxHashList()`: [Get transactions by hash](https://docs.nftscan.com/reference/evm/get-transactions-by-hash)
- ##### Retrieve Collections (`new NftscanEvm().collection.*`)
- ***[PRO]*** `getCollectionsByContract()`: [Get an NFT collection](https://docs.nftscan.com/reference/evm/get-an-nft-collection)
- ***[PRO]*** `queryCollectionsByFilters()`: [Search NFT collections](https://docs.nftscan.com/reference/evm/search-nft-collections)
- ***[PRO]*** `queryCollectionsByAccountAddress()`: [Get NFT collections by account](https://docs.nftscan.com/reference/evm/get-nft-collections-by-account)
- ***[PRO]*** `getCollectionsByRanking()`: [Get NFT collections by ranking](https://docs.nftscan.com/reference/evm/get-nft-collections-by-ranking)
- `getCollectionsByContract()`: [Get an NFT collection](https://docs.nftscan.com/reference/evm/get-an-nft-collection)
- `queryCollectionsByFilters()`: [Search NFT collections](https://docs.nftscan.com/reference/evm/search-nft-collections)
- `queryCollectionsByAccountAddress()`: [Get NFT collections by account](https://docs.nftscan.com/reference/evm/get-nft-collections-by-account)
- `getCollectionsByRanking()`: [Get NFT collections by ranking](https://docs.nftscan.com/reference/evm/get-nft-collections-by-ranking)
- ##### Statistics (`new NftscanEvm().statistic.*`)
- `getTradeRanking()`: [Trade ranking](https://docs.nftscan.com/reference/evm/trade-ranking)
- `getMintRanking()`: [mint ranking](https://docs.nftscan.com/reference/evm/mint-ranking)
- `getMintAmount()`: [Mint amount](https://docs.nftscan.com/reference/evm/mint-amount)
- `getTradersRanking()`: [Traders ranking](https://docs.nftscan.com/reference/evm/traders-ranking)
- `getGasRanking()`: [Gas ranking](https://docs.nftscan.com/reference/evm/gas-ranking)
- ***[PRO]*** `getCollectionRanking()`: [Collection ranking](https://docs.nftscan.com/reference/evm/collection-ranking)
- `getCollectionRanking()`: [Collection ranking](https://docs.nftscan.com/reference/evm/collection-ranking)
- `getMarketplaceRanking()`: [Marketplace ranking](https://docs.nftscan.com/reference/evm/marketplace-ranking)
- `getMarketCapRanking()`: [Market cap ranking](https://docs.nftscan.com/reference/evm/market-cap-ranking)
- ***[PRO]*** `getCollectionStatistics()`: [Collection statistics](https://docs.nftscan.com/reference/evm/collection-statistics)
- ***[PRO]*** `getCollectionTrade()`: [Collection trade distribution](https://docs.nftscan.com/reference/evm/collection-trade-distribution)
- ***[PRO]*** `getCollectionTrending()`: [Collection trending statistics](https://docs.nftscan.com/reference/evm/collection-trending-statistics)
- ***[PRO]*** `getBlueChipStatistics()`: [Blue chip](https://docs.nftscan.com/reference/evm/blue-chip)
- ***[PRO]*** `getAccountOverview()`: [Account overview](https://docs.nftscan.com/reference/evm/account-overview)
- `getCollectionStatistics()`: [Collection statistics](https://docs.nftscan.com/reference/evm/collection-statistics)
- `getCollectionTrade()`: [Collection trade distribution](https://docs.nftscan.com/reference/evm/collection-trade-distribution)
- `getCollectionTrending()`: [Collection trending statistics](https://docs.nftscan.com/reference/evm/collection-trending-statistics)
- `getBlueChipStatistics()`: [Blue chip](https://docs.nftscan.com/reference/evm/blue-chip)
- `getAccountOverview()`: [Account overview](https://docs.nftscan.com/reference/evm/account-overview)
- `getCollectionOverview()`: [Collection overview](https://docs.nftscan.com/reference/evm/collection-overview)
- `getWalletRanking()`: [Wallet Ranking](https://docs.nftscan.com/reference/evm/wallet-ranking)
- `getTradeWalletRanking()`: [Wallet Trade Ranking](https://docs.nftscan.com/reference/evm/wallet-trade-ranking)
- `getCollectionHoldingAmountDistribution()`: [Collection Holding Amount Distribution](https://docs.nftscan.com/reference/evm/collection-holding-amount-distribution)
- `getCollectionHoldingPeriodDistribution()`: [Collection Holding Period Distribution](https://docs.nftscan.com/reference/evm/collection-holding-period-distribution)
- `getCollectionBlueChipList()`: [Collection Blue Chip List](https://docs.nftscan.com/reference/evm/collection-blue-chip-list)
- `getAccountHoldingDistribution()`: [Account Holding Distribution](https://docs.nftscan.com/reference/evm/account-holding-distribution)
- ##### Refresh (`new NftscanEvm().refresh.*`)
- ***[PRO]*** `refreshAsset()`: [Refresh an asset](https://docs.nftscan.com/reference/evm/refresh-nft-metadata)
- ***[PRO]*** `refreshContract()`:[Refresh a contract](https://docs.nftscan.com/reference/evm/refresh-nft-metadata-by-contract)
- `refreshAsset()`: [Refresh an asset](https://docs.nftscan.com/reference/evm/refresh-nft-metadata)
- `refreshContract()`:[Refresh a contract](https://docs.nftscan.com/reference/evm/refresh-nft-metadata-by-contract)
- ##### Other (`new NftscanEvm().other.*`)
- `getBlockNumber()`: [Get latest block number](https://docs.nftscan.com/reference/evm/get-latest-block-number)
- ***[PRO]*** `queryAssestAmountByAccounts()`: [Get NFT amount by account](https://docs.nftscan.com/reference/evm/get-nft-amount-by-account)
- ***[PRO]*** `getAssetOwnerByContract()`: [Get NFT owners by contract](https://docs.nftscan.com/reference/evm/get-nft-owners-by-contract)
- ***[PRO]*** `getAssetOwnerByContractAndTokenId()`: [Asset owner amount for an asset](https://docs.nftscan.com/reference/evm/get-owners-by-an-nft)
- `queryAssestAmountByAccounts()`: [Get NFT amount by account](https://docs.nftscan.com/reference/evm/get-nft-amount-by-account)
- `getAssetOwnerByContract()`: [Get NFT owners by contract](https://docs.nftscan.com/reference/evm/get-nft-owners-by-contract)
- `getAssetOwnerByContractAndTokenId()`: [Asset owner amount for an asset](https://docs.nftscan.com/reference/evm/get-owners-by-an-nft)
- #### NFTScan API of Solana
- ##### Retrieve Assets (`new NftscanSolana().asset.*`)
- `getAssetsByAccount()`: [Get NFTs by account](https://docs.nftscan.com/reference/solana/get-nfts-by-account)
- `getAllAssets()`: [Get all NFTs by account](https://docs.nftscan.com/reference/solana/get-all-nfts-by-account)
- `getAccountMinted()`: [Get minted NFTs by account](https://docs.nftscan.com/reference/solana/get-minted-nfts-by-account)
- ***[PRO]*** `getAssetsByCollection()`: [Get NFTs by collection](https://docs.nftscan.com/reference/solana/get-nfts-by-collection)
- `getAssetsByCollection()`: [Get NFTs by collection](https://docs.nftscan.com/reference/solana/get-nfts-by-collection)
- `getAssetsByTokenAddress()`: [Get single NFT](https://docs.nftscan.com/reference/solana/get-single-nft)
- ***[PRO]*** `queryAssetsInBatches`: [Get multiple NFTs](https://docs.nftscan.com/reference/solana/get-multiple-nfts)
- `queryAssetsInBatches`: [Get multiple NFTs](https://docs.nftscan.com/reference/solana/get-multiple-nfts)
- ##### Retrieve Transactions (`new NftscanSolana().transaction.*`)
- `getTransactionsByAccount()`: [Get transactions by account](https://docs.nftscan.com/reference/solana/get-transactions-by-account)
- `getTransactionsByCollection()`: [Get transactions by collection](https://docs.nftscan.com/reference/solana/get-transactions-by-collection)
- `getTransactionsByTokenAddress()`: [Get transactions by NFT](https://docs.nftscan.com/reference/solana/get-transactions-by-nft)
- ##### Retrieve Collections (`new NftscanSolana().collection.*`)
- ***[PRO]*** `getCollection()`: [Get an NFT collection](https://docs.nftscan.com/reference/solana/get-an-nft-collection)
- ***[PRO]*** `queryCollectionsByFilters()`: [Search NFT collections](https://docs.nftscan.com/reference/solana/search-nft-collections)
- `getCollection()`: [Get an NFT collection](https://docs.nftscan.com/reference/solana/get-an-nft-collection)
- `queryCollectionsByFilters()`: [Search NFT collections](https://docs.nftscan.com/reference/solana/search-nft-collections)
- ##### Statistics (`new NftscanSolana().statistic.*`)
- `getTradeRanking()`: [Trade ranking](https://docs.nftscan.com/reference/solana/trade-ranking)
- `getCollectionStatistics()`: [Collection Statistics](https://docs.nftscan.com/reference/solana/collection-statistics)
- ##### Refresh (`new NftscanSolana().refresh.*`)
- ***[PRO]*** `refreshAsset()`: [Refresh an asset](https://docs.nftscan.com/reference/solana/refresh-nft-metadata)
- `refreshAsset()`: [Refresh an asset](https://docs.nftscan.com/reference/solana/refresh-nft-metadata)

## More
- [NFTScan API](https://developer.nftscan.com/)
Expand Down
38 changes: 10 additions & 28 deletions src/api/evm/asset/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import { nftscanGet, nftscanPost } from '../../../http/nftscan.http';
import {
AccountMintParams,
AssetParams,
AssetsByContractParams,
BatchQueryAssetsListItemParams,
BatchQueryAssetsParams,
CommonAssetParams,
QueryAssetsByAttributesParams,
QueryAssetsByFiltersParams,
} from '../../../types/evm/asset/request-params';
import {
QueryAllAssetsResponse,
Asset,
CollectionAssets,
CommonAssetResponse,
QueryMultiChainAssets,
} from '../../../types/evm/asset/response-data';
Expand Down Expand Up @@ -65,13 +66,9 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
* @param accountAddress The address of the owner of the assets
* @param ercType Can be erc721 or erc1155.
* @param showAttribute Whether to load attribute data of the asset. Default is false
* @returns Promise<Array<{@link QueryAllAssetsResponse}>>
* @returns Promise<Array<{@link CollectionAssets}>>
*/
getAllAssets(
accountAddress: string,
ercType?: ErcType,
showAttribute?: boolean,
): Promise<Array<QueryAllAssetsResponse>> {
getAllAssets(accountAddress: string, ercType?: ErcType, showAttribute?: boolean): Promise<Array<CollectionAssets>> {
if (isEmpty(accountAddress)) {
return missingParamError('accountAddress');
}
Expand All @@ -81,7 +78,7 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
show_attribute: showAttribute,
};

return nftscanGet<NsObject, Array<QueryAllAssetsResponse>>(
return nftscanGet<NsObject, Array<CollectionAssets>>(
this.config,
`${NftscanConst.API.evm.assets.getAllAssets}${accountAddress}`,
params,
Expand Down Expand Up @@ -116,29 +113,26 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Get NFTs by contract
* - This endpoint returns a set of NFTs that belong to an NFT contract address. The NFTs are sorted by token_id with ascending direction.
* - details: {@link https://docs.nftscan.com/reference/evm/get-nfts-by-contract}
* @param contractAddress The NFT contract address for the assets
* @param params The query params {@link CommonAssetParams}
* @param params The query params {@link AssetsByContractParams}
* @returns Promise<{@link CommonAssetResponse}>
*/
getAssetsByContract(contractAddress: string, params?: CommonAssetParams): Promise<CommonAssetResponse> {
getAssetsByContract(contractAddress: string, params?: AssetsByContractParams): Promise<CommonAssetResponse> {
if (isEmpty(contractAddress)) {
return missingParamError('contractAddress');
}

if (params) {
const { limit } = params;
if (limit && limit > 1000) {
return invalidLimitError(1000);
if (limit && limit > 100) {
return invalidLimitError(100);
}
}

return nftscanGet<CommonAssetParams, CommonAssetResponse>(
return nftscanGet<AssetsByContractParams, CommonAssetResponse>(
this.config,
`${NftscanConst.API.evm.assets.getAssets}${contractAddress}`,
params,
Expand Down Expand Up @@ -173,9 +167,6 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Get multiple NFTs
* - This endpoint returns a set of NFTs according to the search list in the request body.
* - details: {@link https://docs.nftscan.com/reference/evm/get-multiple-nfts}
Expand Down Expand Up @@ -204,9 +195,6 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Search NFTs
* - This endpoint returns a list of NFT assets by applying search filters in the request body. The assets are sorted by nftscan_id with ascending direction.
* - details: {@link https://docs.nftscan.com/reference/evm/search-nfts}
Expand Down Expand Up @@ -234,9 +222,6 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Get NFTs by attributes
* - This endpoint returns a set of NFTs those belong to an NFT contract address with attributes. The NFTs are sorted by token_id with ascending direction.
* - details: {@link https://docs.nftscan.com/reference/evm/get-nfts-by-attributes}
Expand Down Expand Up @@ -266,9 +251,6 @@ export default class NftscanEvmAsset extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Get all multi-chain NFTs by account
* - This endpoint returns all multi-chain NFTs owned by an account address. And the NFTs are grouped according to contract address.
* - details: {@link https://docs.nftscan.com/reference/evm/get-all-multi-chain-nfts-by-account}
Expand Down
12 changes: 0 additions & 12 deletions src/api/evm/collection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ import BaseApi from '../../base-api';
*/
export default class NftscanEvmCollection extends BaseApi<NftscanConfig> {
/**
* *****
* [PRO]
* *****
* Get an NFT collection
* - This endpoint returns information for a collection with the given NFT contract address.
* - details: {@link https://docs.nftscan.com/reference/evm/get-an-nft-collection}
Expand All @@ -39,9 +36,6 @@ export default class NftscanEvmCollection extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Get NFT collections by ranking.
* - This endpoint returns information for a list of collections with the given ranking field. The collections are sorted by the given ranking field with the given sort direction.
* - details: {@link https://docs.nftscan.com/reference/evm/get-nft-collections-by-ranking}
Expand All @@ -65,9 +59,6 @@ export default class NftscanEvmCollection extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Search NFT collections.
* - This endpoint returns information for a list of collections by applying search filters in the request body. The collections are sorted by deploy_block_number with ascending direction.
* - details: {@link https://docs.nftscan.com/reference/evm/search-nft-collections}
Expand Down Expand Up @@ -95,9 +86,6 @@ export default class NftscanEvmCollection extends BaseApi<NftscanConfig> {
}

/**
* *****
* [PRO]
* *****
* Get NFT collections by account
* - This endpoint returns information for a list of collections by the account address. The collections are sorted by floor_price with descending direction.
* - details: {@link https://docs.nftscan.com/reference/evm/get-nft-collections-by-account}
Expand Down
Loading

0 comments on commit 340db9c

Please sign in to comment.