@covalenthq/client-sdk
Version:
<div align="center"> <a href="https://goldrush.dev/" target="_blank" rel="noopener noreferrer"> <img alt="GoldRush TS SDK Logo" src="../../repo-static/ts-sdk-banner.png" style="max-width: 100%;"/> </a> </div>
176 lines (175 loc) • 10.9 kB
TypeScript
import { type Execution } from "../utils/functions/execution";
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.
*
* **Credit Cost**: 1 per call
*
* @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. Only supports the resolution of a registered domain to an address.
*
* **Credit Cost**: 1 per call
*
* @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.
*
* **Credit Cost**: 1 per call
*
* @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.
*
* **Credit Cost**: 1 per call
*
* @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.
*
* **Credit Cost**: 0.01 per item
*
* @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.
*
* **Credit Cost**: 0.01 per item
*
* @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.
*
* **Credit Cost**: 0.01 per item
*
* @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.
*
* **Credit Cost**: 0.01 per item
*
* @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.
*
* **Credit Cost**: 0.01 per item
*
* @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.
*
* **Credit Cost**: 0.01 per call
*
*/
getAllChains(): Promise<GoldRushResponse<AllChainsResponse>>;
/**
*
* Commonly used to build internal status dashboards of all supported chains.
*
* **Credit Cost**: 1 per call
*
*/
getAllChainStatus(): Promise<GoldRushResponse<AllChainsStatusResponse>>;
/**
*
* Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times.
*
* **Credit Cost**: 1 per call
*
* @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>>;
}