UNPKG

@covalenthq/client-sdk

Version:

<div align="center"> <a href="https://goldrush.dev/products/goldrush/" target="_blank" rel="noopener noreferrer"> <img alt="GoldRush TS SDK Logo" src="./repo-static/ts-sdk-banner.png" style="max-width: 100%;"/> </a> </div>

194 lines (193 loc) 15.5 kB
import { type Execution } from "../utils/functions/execution"; import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types"; import { type ChainCollectionResponse, type CheckOwnershipInNftQueryParamOpts, type GetChainCollectionsQueryParamOpts, type GetCollectionMarketDataQueryParamOpts, type GetNftMetadataForGivenTokenIdForContractQueryParamOpts, type GetNftTransactionsForContractTokenIdQueryParamOpts, type GetNftsForAddressQueryParamOpts, type GetTokenIdsForContractWithMetadataQueryParamOpts, type NftAddressBalanceNftResponse, type NftCollectionAttributesForTraitResponse, type NftCollectionFloorPriceResponse, type NftCollectionSalesCountResponse, type NftCollectionTraitsResponse, type NftCollectionTraitsSummaryResponse, type NftCollectionVolumeResponse, type NftMetadataResponse, type NftOwnershipForCollectionResponse, type NftTransactionsResponse } from "../utils/types/NftService.types"; /** * NFTs API * */ export declare class NftService { private execution; constructor(execution: Execution); /** * * Commonly used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {GetChainCollectionsQueryParamOpts} queryParamOpts * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100. * - `pageNumber`: 0-indexed page number to begin pagination. * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. * */ getChainCollections(chainName: Chain, queryParamOpts?: GetChainCollectionsQueryParamOpts): AsyncIterable<GoldRushResponse<ChainCollectionResponse>>; /** * * Commonly used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {GetChainCollectionsQueryParamOpts} queryParamOpts * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100. * - `pageNumber`: 0-indexed page number to begin pagination. * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. * */ getChainCollectionsByPage(chainName: Chain, queryParamOpts?: GetChainCollectionsQueryParamOpts): Promise<GoldRushResponse<ChainCollectionResponse>>; /** * * Commonly used to render the NFTs (including ERC721 and ERC1155) held by an address. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {GetNftsForAddressQueryParamOpts} queryParamOpts * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. * - `noNftAssetMetadata`: If `true`, the response shape is limited to a list of collections and token ids, omitting metadata and asset information. Helpful for faster response times and wallets holding a large number of NFTs. * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side. * */ getNftsForAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetNftsForAddressQueryParamOpts): Promise<GoldRushResponse<NftAddressBalanceNftResponse>>; /** * * Commonly used to get NFT token IDs with metadata from a collection. Useful for building NFT card displays. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {GetTokenIdsForContractWithMetadataQueryParamOpts} queryParamOpts * - `noMetadata`: Omit metadata. * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100. * - `pageNumber`: 0-indexed page number to begin pagination. * - `traitsFilter`: Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding. * - `valuesFilter`: Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. If used with "traits-filter", only NFTs matching both filters will be returned. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding. * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side. * */ getTokenIdsForContractWithMetadata(chainName: Chain, contractAddress: string, queryParamOpts?: GetTokenIdsForContractWithMetadataQueryParamOpts): AsyncIterable<GoldRushResponse<NftMetadataResponse>>; /** * * Commonly used to get NFT token IDs with metadata from a collection. Useful for building NFT card displays. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {GetTokenIdsForContractWithMetadataQueryParamOpts} queryParamOpts * - `noMetadata`: Omit metadata. * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100. * - `pageNumber`: 0-indexed page number to begin pagination. * - `traitsFilter`: Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding. * - `valuesFilter`: Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. If used with "traits-filter", only NFTs matching both filters will be returned. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding. * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side. * */ getTokenIdsForContractWithMetadataByPage(chainName: Chain, contractAddress: string, queryParamOpts?: GetTokenIdsForContractWithMetadataQueryParamOpts): Promise<GoldRushResponse<NftMetadataResponse>>; /** * * Commonly used to get a single NFT metadata by token ID from a collection. Useful for building NFT card displays. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {string} tokenId - The requested token ID. * @param {GetNftMetadataForGivenTokenIdForContractQueryParamOpts} queryParamOpts * - `noMetadata`: Omit metadata. * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side. * */ getNftMetadataForGivenTokenIdForContract(chainName: Chain, contractAddress: string, tokenId: string, queryParamOpts?: GetNftMetadataForGivenTokenIdForContractQueryParamOpts): Promise<GoldRushResponse<NftMetadataResponse>>; /** * * Commonly used to get all transactions of an NFT token. Useful for building a transaction history table or price chart. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {string} tokenId - The requested token ID. * @param {GetNftTransactionsForContractTokenIdQueryParamOpts} queryParamOpts * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. * */ getNftTransactionsForContractTokenId(chainName: Chain, contractAddress: string, tokenId: string, queryParamOpts?: GetNftTransactionsForContractTokenIdQueryParamOpts): Promise<GoldRushResponse<NftTransactionsResponse>>; /** * * Commonly used to fetch and render the traits of a collection as seen in rarity calculators. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * */ getTraitsForCollection(chainName: Chain, collectionContract: string): Promise<GoldRushResponse<NftCollectionTraitsResponse>>; /** * * Commonly used to get the count of unique values for traits within an NFT collection. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {string} trait - The requested trait. * */ getAttributesForTraitInCollection(chainName: Chain, collectionContract: string, trait: string): Promise<GoldRushResponse<NftCollectionAttributesForTraitResponse>>; /** * * Commonly used to calculate rarity scores for a collection based on its traits. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * */ getCollectionTraitsSummary(chainName: Chain, collectionContract: string): Promise<GoldRushResponse<NftCollectionTraitsSummaryResponse>>; /** * * Commonly used to render a price floor chart for an NFT collection. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} collectionAddress - The requested address. * @param {GetNftsForAddressQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days. * */ getHistoricalFloorPricesForCollection(chainName: Chain, collectionAddress: string, queryParamOpts?: GetCollectionMarketDataQueryParamOpts): Promise<GoldRushResponse<NftCollectionFloorPriceResponse>>; /** * * Commonly used to build a time-series chart of the transaction volume of an NFT collection. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} collectionAddress - The requested address. * @param {GetNftsForAddressQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days. * */ getHistoricalVolumeForCollection(chainName: Chain, collectionAddress: string, queryParamOpts?: GetCollectionMarketDataQueryParamOpts): Promise<GoldRushResponse<NftCollectionVolumeResponse>>; /** * * Commonly used to build a time-series chart of the sales count of an NFT collection. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} collectionAddress - The requested address. * @param {GetNftsForAddressQueryParamOpts} queryParamOpts * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days. * */ getHistoricalSalesCountForCollection(chainName: Chain, collectionAddress: string, queryParamOpts?: GetCollectionMarketDataQueryParamOpts): Promise<GoldRushResponse<NftCollectionSalesCountResponse>>; /** * * Commonly used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {string} collectionContract - The requested collection address. * @param {CheckOwnershipInNftQueryParamOpts} queryParamOpts * - `traitsFilter`: Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Must be used with "values-filter", is case-sensitive, and requires proper URL encoding. * - `valuesFilter`: Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. Must be used with "traits-filter", is case-sensitive, and requires proper URL encoding. * */ checkOwnershipInNft(chainName: Chain, walletAddress: string, collectionContract: string, queryParamOpts?: CheckOwnershipInNftQueryParamOpts): Promise<GoldRushResponse<NftOwnershipForCollectionResponse>>; /** * * Commonly used to verify ownership of a specific token (ERC-721 or ERC-1155) within a collection. * * @param {string} chainName - The chain name eg: `eth-mainnet`. * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. * @param {string} tokenId - The requested token ID. * */ checkOwnershipInNftForSpecificTokenId(chainName: Chain, walletAddress: string, collectionContract: string, tokenId: string): Promise<GoldRushResponse<NftOwnershipForCollectionResponse>>; }