@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>
164 lines (163 loc) • 11 kB
TypeScript
import { type Execution } from "../utils/functions/execution";
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts } from "../utils/types/AllChainService.types";
import { type AllChainsResponse, type AllChainsStatusResponse, type BlockHeightsResponse, type BlockResponse, type GasPricesResponse, type GetBlockHeightsQueryParamOpts, type GetGasPricesQueryParamOpts, type GetLogEventsByAddressQueryParamOpts, type GetLogEventsByTopicHashQueryParamOpts, type GetLogsQueryParamOpts, type GetLogsResponse, type LogEventsByAddressResponse, type LogEventsByTopicHashResponse, type ResolvedAddress } from "../utils/types/BaseService.types";
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types";
/**
* Base API
*
*/
export declare class BaseService {
private execution;
constructor(execution: Execution);
/**
*
* Commonly used to fetch and render a single block for a block explorer.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} blockHeight - The block height or `latest` for the latest block available.
*
*/
getBlock(chainName: Chain, blockHeight: string): Promise<GoldRushResponse<BlockResponse>>;
/**
*
* Commonly used to resolve ENS, RNS and Unstoppable Domains addresses.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
*
*/
getResolvedAddress(chainName: Chain, walletAddress: string): Promise<GoldRushResponse<ResolvedAddress>>;
/**
*
* Commonly used to get all the block heights within a particular date range. Useful for rendering a display where you sort blocks by day.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} startDate - The start date in YYYY-MM-DD format.
* @param {string | "latest"} endDate - The end date in YYYY-MM-DD format. Also accepts "latest" for the latest block height
* @param {GetBlockHeightsQueryParamOpts} queryParamOpts
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
* - `pageNumber`: 0-indexed page number to begin pagination.
*
*/
getBlockHeights(chainName: Chain, startDate: string, endDate: string | "latest", queryParamOpts?: GetBlockHeightsQueryParamOpts): AsyncIterable<GoldRushResponse<BlockHeightsResponse>>;
/**
*
* Commonly used to get all the block heights within a particular date range. Useful for rendering a display where you sort blocks by day.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} startDate - The start date in YYYY-MM-DD format.
* @param {string | "latest"} endDate - The end date in YYYY-MM-DD format. Also accepts "latest" for the latest block height
* @param {GetBlockHeightsQueryParamOpts} queryParamOpts
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
* - `pageNumber`: 0-indexed page number to begin pagination.
*
*/
getBlockHeightsByPage(chainName: Chain, startDate: string, endDate: string | "latest", queryParamOpts?: GetBlockHeightsQueryParamOpts): Promise<GoldRushResponse<BlockHeightsResponse>>;
/**
*
* Commonly used to get all the event logs of the latest block, or for a range of blocks. Includes sender contract metadata as well as decoded logs.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {GetLogsQueryParamOpts} queryParamOpts
* - `startingBlock`: The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `endingBlock`: The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `address`: The address of the log events sender contract.
* - `topics`: The topic hash(es) to retrieve logs with.
* - `blockHash`: The block hash to retrieve logs for.
* - `skipDecode`: Omit decoded log events.
*
*/
getLogs(chainName: Chain, queryParamOpts?: GetLogsQueryParamOpts): Promise<GoldRushResponse<GetLogsResponse>>;
/**
*
* Commonly used to get all the event logs emitted from a particular contract address. Useful for building dashboards that examine on-chain interactions.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
* @param {GetLogEventsByAddressQueryParamOpts} queryParamOpts
* - `startingBlock`: The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `endingBlock`: The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
* - `pageNumber`: 0-indexed page number to begin pagination.
*
*/
getLogEventsByAddress(chainName: Chain, contractAddress: string, queryParamOpts?: GetLogEventsByAddressQueryParamOpts): AsyncIterable<GoldRushResponse<LogEventsByAddressResponse>>;
/**
*
* Commonly used to get all the event logs emitted from a particular contract address. Useful for building dashboards that examine on-chain interactions.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
* @param {GetLogEventsByAddressQueryParamOpts} queryParamOpts
* - `startingBlock`: The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `endingBlock`: The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
* - `pageNumber`: 0-indexed page number to begin pagination.
*
*/
getLogEventsByAddressByPage(chainName: Chain, contractAddress: string, queryParamOpts?: GetLogEventsByAddressQueryParamOpts): Promise<GoldRushResponse<LogEventsByAddressResponse>>;
/**
*
* Commonly used to get all event logs of the same topic hash across all contracts within a particular chain. Useful for cross-sectional analysis of event logs that are emitted on-chain.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} topicHash - The endpoint will return event logs that contain this topic hash.
* @param {GetLogEventsByTopicHashQueryParamOpts} queryParamOpts
* - `startingBlock`: The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `endingBlock`: The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `secondaryTopics`: Additional topic hash(es) to filter on - padded & unpadded address fields are supported. Separate multiple topics with a comma.
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
* - `pageNumber`: 0-indexed page number to begin pagination.
*
*/
getLogEventsByTopicHash(chainName: Chain, topicHash: string, queryParamOpts?: GetLogEventsByTopicHashQueryParamOpts): AsyncIterable<GoldRushResponse<LogEventsByTopicHashResponse>>;
/**
*
* Commonly used to get all event logs of the same topic hash across all contracts within a particular chain. Useful for cross-sectional analysis of event logs that are emitted on-chain.
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} topicHash - The endpoint will return event logs that contain this topic hash.
* @param {GetLogEventsByTopicHashQueryParamOpts} queryParamOpts
* - `startingBlock`: The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `endingBlock`: The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
* - `secondaryTopics`: Additional topic hash(es) to filter on - padded & unpadded address fields are supported. Separate multiple topics with a comma.
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
* - `pageNumber`: 0-indexed page number to begin pagination.
*
*/
getLogEventsByTopicHashByPage(chainName: Chain, topicHash: string, queryParamOpts?: GetLogEventsByTopicHashQueryParamOpts): Promise<GoldRushResponse<LogEventsByTopicHashResponse>>;
/**
*
* Commonly used to build internal dashboards for all supported chains on Covalent.
*
*
*/
getAllChains(): Promise<GoldRushResponse<AllChainsResponse>>;
/**
*
* Commonly used to build internal status dashboards of all supported chains.
*
*
*/
getAllChainStatus(): Promise<GoldRushResponse<AllChainsStatusResponse>>;
/**
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getAddressActivity` instead.
*
* Commonly used to locate chains which an address is active on with a single API call.
*
* @param {string} walletAddress - The requested wallet address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
* @param {GetAddressActivityQueryParamOpts} queryParamOpts
* - `testnets`: Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity.
*
*/
getAddressActivity(walletAddress: string, queryParamOpts?: GetAddressActivityQueryParamOpts): Promise<GoldRushResponse<ChainActivityResponse>>;
/**
*
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
* @param {string} eventType - The desired event type to retrieve gas prices for. Supports `erc20` transfer events, `uniswapv3` swap events and `nativetokens` transfers.
* @param {GetGasPricesQueryParamOpts} queryParamOpts
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
*
*/
getGasPrices(chainName: Chain, eventType: "erc20" | "nativetokens" | "uniswapv3", queryParamOpts?: GetGasPricesQueryParamOpts): Promise<GoldRushResponse<GasPricesResponse>>;
}