UNPKG

@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>

313 lines (312 loc) 12.5 kB
import { type ChainID, type ChainLabel, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types"; export type BlockResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * List of response items. */ items: Block[]; }>; export type Block = Nullable<{ /** * The hash of the block. */ block_hash: string; /** * The block signed timestamp in UTC. */ signed_at: Date; /** * The block height. */ height: number; /** * The parent block hash. */ block_parent_hash: string; /** * Extra data written to the block. */ extra_data: string; /** * The address of the miner. */ miner_address: string; /** * The associated mining cost. */ mining_cost: number; /** * The associated gas used. */ gas_used: number; /** * The associated gas limit. */ gas_limit: number; /** * The link to the related tx by block endpoint. */ transactions_link: string; }>; export type ResolvedAddress = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * List of response items. */ items: ResolvedAddressItem[]; }>; export type ResolvedAddressItem = Nullable<{ /** * The requested address. */ address: string; name: string; }>; export type BlockHeightsResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * List of response items. */ items: BlockHeights[]; /** * Pagination metadata. */ pagination: Pagination; }>; export type BlockHeights = Nullable<{ /** * The hash of the block. */ block_hash: string; /** * The block signed timestamp in UTC. */ signed_at: Date; /** * The block height. */ height: number; /** * The parent block hash. */ block_parent_hash: string; /** * Extra data written to the block. */ extra_data: string; /** * The address of the miner. */ miner_address: string; /** * The associated mining cost. */ mining_cost: number; /** * The associated gas used. */ gas_used: number; /** * The associated gas limit. */ gas_limit: number; /** * The link to the related tx by block endpoint. */ transactions_link: string; }>; export type GetLogsResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * List of response items. */ items: GetLogsEvent[]; }>; export type GetLogsEvent = Nullable<{ /** * The block signed timestamp in UTC. */ block_signed_at: Date; /** * The height of the block. */ block_height: number; /** * The hash of the block. */ block_hash: string; /** * The offset is the position of the tx in the block. */ tx_offset: number; /** * The offset is the position of the log entry within an event log. */ log_offset: number; /** * The requested transaction hash. */ tx_hash: string; /** * The log topics in raw data. */ raw_log_topics: string[]; /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ sender_contract_decimals: number; /** * The name of the sender. */ sender_name: string; /** * The ticker symbol for the sender. This field is set by a developer and non-unique across a network. */ sender_contract_ticker_symbol: string; /** * The address of the sender. */ sender_address: string; /** * The label of the sender address. */ sender_address_label: string; /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ supports_erc: string[]; /** * The contract logo URL. */ sender_logo_url: string; /** * The address of the deployed UniswapV2 like factory contract for this DEX. */ sender_factory_address: string; /** * The log events in raw. */ raw_log_data: string; /** * The decoded item. */ decoded: DecodedItem; }>; export type LogEventsByAddressResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * List of response items. */ items: LogEvent[]; /** * Pagination metadata. */ pagination: Pagination; }>; export type LogEventsByTopicHashResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * List of response items. */ items: LogEvent[]; /** * Pagination metadata. */ pagination: Pagination; }>; export type AllChainsResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * List of response items. */ items: ChainItem[]; }>; export type ChainItem = Nullable<{ /** * The chain name eg: `eth-mainnet`. */ name: string; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * True if the chain is a testnet. */ is_testnet: boolean; /** * Schema name to use for direct SQL. */ db_schema_name: string; /** * The chains label eg: `Ethereum Mainnet`. */ label: string; /** * The category label eg: `Ethereum`. */ category_label: string; /** * A svg logo url for the chain. */ logo_url: string; /** * A black png logo url for the chain. */ black_logo_url: string; /** * A white png logo url for the chain. */ white_logo_url: string; /** * The color theme for the chain. */ color_theme: ColorTheme; /** * True if the chain is an AppChain. */ is_appchain: boolean; /** * The ChainItem the appchain is a part of. */ appchain_of: ChainItem; /** * A classification of the chain */ priority_label: ChainLabel; }>; export type ColorTheme = Nullable<{ /** * The red color code. */ red: number; /** * The green color code. */ green: number; /** * The blue color code. */ blue: number; /** * The alpha color code. */ alpha: number; /** * The hexadecimal color code. */ hex: string; /** * The color represented in css rgb() functional notation. */ css_rgb: string; }>; export type AllChainsStatusResponse = Nullable<{ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * List of response items. */ items: ChainStatusItem[]; }>; export type ChainStatusItem = Nullable<{ /** * The chain name eg: `eth-mainnet`. */ name: string; /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * True if the chain is a testnet. */ is_testnet: boolean; /** * A svg logo url for the chain. */ logo_url: string; /** * A black png logo url for the chain. */ black_logo_url: string; /** * A white png logo url for the chain. */ white_logo_url: string; /** * True if the chain is an AppChain. */ is_appchain: boolean; /** * The height of the latest block available. */ synced_block_height: number; /** * The signed timestamp of latest block available. */ synced_blocked_signed_at: Date; /** * True if the chain has data and ready for querying. */ has_data: boolean; }>; export type GasPricesResponse = Nullable<{ /** * The requested chain ID eg: `1`. */ chain_id: ChainID; /** * The requested chain name eg: `eth-mainnet`. */ chain_name: ChainName; /** * The requested quote currency eg: `USD`. */ quote_currency: Quote; /** * The timestamp when the response was generated. Useful to show data staleness to users. */ updated_at: Date; /** * The requested event type. */ event_type: string; /** * The exchange rate for the requested quote currency. */ gas_quote_rate: number; /** * The lowest gas fee for the latest block height. */ base_fee: bigint; /** * List of response items. */ items: PriceItem[]; }>; export type PriceItem = Nullable<{ /** * The average gas price, in WEI, for the time interval. */ gas_price: string; /** * The average gas spent for the time interval. */ gas_spent: string; /** * The average gas spent in `quote-currency` denomination for the time interval. */ gas_quote: number; /** * Other fees, when applicable. For example: OP chain L1 fees. */ other_fees: OtherFees; /** * The sum of the L1 and L2 gas spent, in quote-currency, for the specified time interval. */ total_gas_quote: number; /** * A prettier version of the total average gas spent, in quote-currency, for the specified time interval, for rendering purposes. */ pretty_total_gas_quote: string; /** * The specified time interval. */ interval: string; }>; export type OtherFees = Nullable<{ /** * The calculated L1 gas spent, when applicable, in quote-currency, for the specified time interval. */ l1_gas_quote: number; }>; export type GetBlockHeightsQueryParamOpts = Nullable<{ /** * Number of items per page. Omitting this parameter defaults to 100. */ pageSize?: number; /** * 0-indexed page number to begin pagination. */ pageNumber?: number; }>; export type GetLogsQueryParamOpts = Nullable<{ /** * The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */ startingBlock?: number; /** * The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */ endingBlock?: string; /** * The address of the log events sender contract. */ address?: string; /** * The topic hash(es) to retrieve logs with. */ topics?: string; /** * The block hash to retrieve logs for. */ blockHash?: string; /** * Omit decoded log events. */ skipDecode?: boolean; }>; export type GetLogEventsByAddressQueryParamOpts = Nullable<{ /** * The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */ startingBlock?: string | number; /** * The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */ endingBlock?: string | number; /** * Number of items per page. Omitting this parameter defaults to 100. */ pageSize?: number; /** * 0-indexed page number to begin pagination. */ pageNumber?: number; }>; export type GetLogEventsByTopicHashQueryParamOpts = Nullable<{ /** * The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */ startingBlock?: string | number; /** * The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */ endingBlock?: string | number; /** * Additional topic hash(es) to filter on - padded & unpadded address fields are supported. Separate multiple topics with a comma. */ secondaryTopics?: string; /** * Number of items per page. Omitting this parameter defaults to 100. */ pageSize?: number; /** * 0-indexed page number to begin pagination. */ pageNumber?: number; }>; export type GetGasPricesQueryParamOpts = Nullable<{ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */ quoteCurrency?: Quote; }>;