@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>
293 lines (292 loc) • 9.91 kB
TypeScript
export declare enum ChainName {
ETH_MAINNET = "eth-mainnet",
ETH_SEPOLIA = "eth-sepolia",
ETH_HOLESKY = "eth-holesky",
MATIC_MAINNET = "matic-mainnet",
AVALANCHE_MAINNET = "avalanche-mainnet",
AVALANCHE_TESTNET = "avalanche-testnet",
BSC_MAINNET = "bsc-mainnet",
BSC_TESTNET = "bsc-testnet",
MOONBEAM_MAINNET = "moonbeam-mainnet",
MOONBEAM_MOONRIVER = "moonbeam-moonriver",
ARBITRUM_MAINNET = "arbitrum-mainnet",
ARBITRUM_NOVA_MAINNET = "arbitrum-nova-mainnet",
ARBITRUM_SEPOLIA = "arbitrum-sepolia",
FANTOM_MAINNET = "fantom-mainnet",
FANTOM_TESTNET = "fantom-testnet",
BTC_MAINNET = "btc-mainnet",
SOLANA_MAINNET = "solana-mainnet",
AXIE_MAINNET = "axie-mainnet",
OPTIMISM_MAINNET = "optimism-mainnet",
OPTIMISM_SEPOLIA = "optimism-sepolia",
CRONOS_ZKEVM_MAINNET = "cronos-zkevm-mainnet",
EMERALD_PARATIME_MAINNET = "emerald-paratime-mainnet",
MONAD_TESTNET = "monad-testnet",
MONAD_MAINNET = "monad-mainnet",
MEGAETH_MAINNET = "megaeth-mainnet",
BERACHAIN_MAINNET = "berachain-mainnet",
BERACHAIN_TESTNET = "berachain-testnet",
HYPERCORE_MAINNET = "hypercore-mainnet",
PLASMA_MAINNET = "plasma-mainnet",
UNICHAIN_MAINNET = "unichain-mainnet",
PLASMA_TESTNET = "plasma-testnet",
ARC_TESTNET = "arc-testnet",
ADI_TESTNET = "adi-testnet",
CANTO_MAINNET = "canto-mainnet",
LINEA_MAINNET = "linea-mainnet",
LINEA_SEPOLIA_TESTNET = "linea-sepolia-testnet",
POLYGON_AMOY_TESTNET = "polygon-amoy-testnet",
MANTLE_MAINNET = "mantle-mainnet",
BASE_MAINNET = "base-mainnet",
BASE_SEPOLIA_TESTNET = "base-sepolia-testnet",
OASIS_SAPPHIRE_MAINNET = "oasis-sapphire-mainnet",
CELO_MAINNET = "celo-mainnet",
HYPEREVM_MAINNET = "hyperevm-mainnet",
ADI_MAINNET = "adi-mainnet",
REDSTONE_MAINNET = "redstone-mainnet",
SEI_MAINNET = "sei-mainnet",
APECHAIN_MAINNET = "apechain-mainnet",
UNICHAIN_SEPOLIA_TESTNET = "unichain-sepolia-testnet",
SONIC_MAINNET = "sonic-mainnet",
WORLD_MAINNET = "world-mainnet",
WORLD_SEPOLIA_TESTNET = "world-sepolia-testnet",
MANTA_SEPOLIA_TESTNET = "manta-sepolia-testnet",
INK_SEPOLIA_TESTNET = "ink-sepolia-testnet",
INK_MAINNET = "ink-mainnet",
ZKSYNC_MAINNET = "zksync-mainnet",
BNB_OPBNB_MAINNET = "bnb-opbnb-mainnet",
ZETACHAIN_MAINNET = "zetachain-mainnet",
GNOSIS_MAINNET = "gnosis-mainnet",
GNOSIS_TESTNET = "gnosis-testnet",
VICTION_MAINNET = "viction-mainnet",
TAIKO_MAINNET = "taiko-mainnet",
BLAST_MAINNET = "blast-mainnet",
SCROLL_MAINNET = "scroll-mainnet"
}
export declare enum ChainID {
ETH_MAINNET = 1,
ETH_SEPOLIA = 11155111,
ETH_HOLESKY = 17000,
MATIC_MAINNET = 137,
AVALANCHE_MAINNET = 43114,
AVALANCHE_TESTNET = 43113,
BSC_MAINNET = 56,
BSC_TESTNET = 97,
MOONBEAM_MAINNET = 1284,
MOONBEAM_MOONRIVER = 1285,
ARBITRUM_MAINNET = 42161,
ARBITRUM_NOVA_MAINNET = 42170,
ARBITRUM_SEPOLIA = 421614,
FANTOM_MAINNET = 250,
FANTOM_TESTNET = 4002,
BTC_MAINNET = 20090103,
SOLANA_MAINNET = 1399811149,
AXIE_MAINNET = 2020,
OPTIMISM_MAINNET = 10,
OPTIMISM_SEPOLIA = 11155420,
CRONOS_ZKEVM_MAINNET = 388,
EMERALD_PARATIME_MAINNET = 42262,
MONAD_TESTNET = 10143,
MONAD_MAINNET = 143,
MEGAETH_MAINNET = 4326,
BERACHAIN_MAINNET = 80094,
BERACHAIN_TESTNET = 80084,
PLASMA_MAINNET = 9745,
UNICHAIN_MAINNET = 130,
PLASMA_TESTNET = 9746,
ARC_TESTNET = 5042002,
ADI_TESTNET = 99999,
CANTO_MAINNET = 7700,
LINEA_MAINNET = 59144,
LINEA_SEPOLIA_TESTNET = 59141,
POLYGON_AMOY_TESTNET = 80002,
MANTLE_MAINNET = 5000,
BASE_MAINNET = 8453,
BASE_SEPOLIA_TESTNET = 84532,
OASIS_SAPPHIRE_MAINNET = 23294,
CELO_MAINNET = 42220,
HYPEREVM_MAINNET = 999,
ADI_MAINNET = 36900,
REDSTONE_MAINNET = 690,
SEI_MAINNET = 1329,
APECHAIN_MAINNET = 33139,
UNICHAIN_SEPOLIA_TESTNET = 1301,
SONIC_MAINNET = 146,
WORLD_MAINNET = 480,
WORLD_SEPOLIA_TESTNET = 4801,
MANTA_SEPOLIA_TESTNET = 3441006,
INK_SEPOLIA_TESTNET = 763373,
INK_MAINNET = 57073,
ZKSYNC_MAINNET = 324,
BNB_OPBNB_MAINNET = 204,
ZETACHAIN_MAINNET = 7000,
GNOSIS_MAINNET = 100,
GNOSIS_TESTNET = 10200,
VICTION_MAINNET = 88,
TAIKO_MAINNET = 167000,
BLAST_MAINNET = 81457,
SCROLL_MAINNET = 534352
}
export type Chain = ChainID | ChainName | `${ChainName}` | `${ChainID}`;
export type Source = "Ponder" | "GoldRush" | "Viem";
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP";
export type CryptocurrencyQuote = "ETH" | "BTC";
export type ChainLabel = "Foundational" | "Frontier" | "Community";
export interface Pagination {
/** * True is there is another page. */
has_more: boolean;
/** * The requested page number. */
page_number: number;
/** * The requested number of items on the current page. */
page_size: number;
/** * The total number of items across all pages for this request. */
total_count: number;
}
export interface PaginationLinks {
/** * URL link to the next page. */
prev: string;
/** * URL link to the previous page. */
next: string;
}
export interface NftCollectionAttribute {
trait_type: string;
value: string;
}
export type NftData = Nullable<{
/** * The token's id. */
token_id: bigint;
token_url: string;
/** * The original minter. */
original_owner: string;
/** * The current holder of this NFT. */
current_owner: string;
external_data: NftExternalData;
/** * If `true`, the asset data is available from the Covalent CDN. */
asset_cached: boolean;
/** * If `true`, the image data is available from the Covalent CDN. */
image_cached: boolean;
}>;
export interface NftExternalData {
name: string;
description: string;
asset_url: string;
asset_file_extension: string;
asset_mime_type: string;
asset_size_bytes: string;
image: string;
image_256: string;
image_512: string;
image_1024: string;
animation_url: string;
external_url: string;
attributes: NftCollectionAttribute[];
thumbnails: NFTThumbnails;
}
export interface NFTThumbnails {
image256: string;
image512: string;
image1024: string;
image_opengraph_url: string;
thumbhash: string;
}
export interface DecodedItem {
name: string;
signature: string;
params: Param[];
}
export interface Param {
name: string;
type: string;
indexed: boolean;
decoded: boolean;
value: string;
}
export type LogEvent = Nullable<{
/** * The block signed timestamp in UTC. */
block_signed_at: Date;
/** * The height of the block. */
block_height: number;
/** * 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;
sender_contract_ticker_symbol: string;
/** * The address of the sender. */
sender_address: string;
/** * The label of the sender address. */
sender_address_label: string;
/** * The contract logo URL. */
sender_logo_url: string;
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
supports_erc: 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 interface ContractMetadata {
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
contract_decimals: number;
/** * The string returned by the `name()` method. */
contract_name: string;
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
contract_ticker_symbol: string;
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
contract_address: string;
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
supports_erc: string[];
/** * The contract logo URL. */
logo_url: string;
}
export interface Explorer {
/** * The name of the explorer. */
label: string;
/** * The URL of the explorer. */
url: string;
}
export interface LogoUrls {
/** * The token logo URL. */
token_logo_url: string;
/** * The protocol logo URL. */
protocol_logo_url: string;
/** * The chain logo URL. */
chain_logo_url: string;
}
export type GoldRushResponse<T> = {
data: T;
error: false | null;
error_code: null;
error_message: null;
} | {
data: null;
error: true;
error_code: number;
error_message: string;
};
export interface GoldRushClientSettings {
/** * Toggle to analyze the execution of each api request. */
debug?: boolean;
/** * The number of concurrent requests allowed. */
threadCount?: number;
/** Toggle to turn on and off retry logic */
enableRetry?: boolean;
/** Set the retry logic count */
maxRetries?: number;
/** Set the retry delay in ms */
retryDelay?: number;
/** Set the source of the usage */
source?: Source | string;
}
export type Nullable<T> = {
[P in keyof T]: T[P] | null;
};