UNPKG

chaingate

Version:

Multi-chain cryptocurrency SDK for TypeScript — unified API for Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Polygon, Arbitrum, and any EVM-compatible chain. Create wallets, query balances, send transactions, and manage tokens and NFTs across UTXO

126 lines (125 loc) 5.09 kB
import type { Client } from '../Client/client'; import type { EvmAddressHistoryResponse, EvmAddressTxCountResponse, EvmBlockResponse, EvmBlockByHeightResponse, EvmBroadcastTxResponse, EvmCallContractBody, EvmCallContractResponse, EvmEstimateGasResponse, EvmFeeRateResponse, EvmLatestBlockResponse, EvmNetworkStatusResponse, EvmNftMetadataResponse, EvmNonceResponse, EvmTokenDataResponse, EvmTxDetailsResponse } from '../Client'; import { Amount } from '../utils/Amount'; import type { ChainGateGlobal } from '../ChainGate/ChainGate'; export type EvmNetwork = 'ethereum' | 'avalanche'; export declare class EvmExplorer { /** @internal */ readonly client: Client; /** @internal */ readonly network: EvmNetwork; /** @internal */ readonly baseUrl: string; /** @internal */ readonly apiKey: string | undefined; /** @internal */ readonly global: ChainGateGlobal; constructor(client: Client, network: EvmNetwork, baseUrl: string, apiKey: string | undefined, global: ChainGateGlobal); /** Returns the native coin data for this network. */ private nativeData; /** * Returns the confirmed and unconfirmed balance for an EVM address. * * The `confirmed` and `unconfirmed` fields are returned as `Amount` instances * with native token metadata (symbol, name, network). */ getAddressBalance(address: string): Promise<{ address: string; confirmed: Amount; unconfirmed: Amount; }>; /** * Returns paginated transaction history for an EVM address, including decoded * contract events (transfers, mints, approvals, etc.). */ getAddressHistory(address: string, page?: string): Promise<EvmAddressHistoryResponse>; /** * Returns all ERC-20/ERC-721/ERC-1155 token balances for an EVM address. * * Each balance is returned as an {@link Amount} instance. Use `isToken` and * `isNFT` to distinguish token types, and access `contractAddress` or * `ownedTokens` accordingly. */ getAddressTokenBalances(address: string): Promise<Amount[]>; /** * Returns the nonce (transaction count) for an EVM address. */ getAddressTransactionCount(address: string): Promise<EvmAddressTxCountResponse>; /** * Returns the next nonce to use when sending a transaction from an EVM address. */ getNonce(address: string): Promise<EvmNonceResponse>; /** * Returns detailed information about a transaction by its hash. * * The `amount` field is returned as an `Amount` instance with native token metadata. */ getTransactionDetails(transactionId: string): Promise<Omit<EvmTxDetailsResponse, 'amount'> & { amount: Amount; }>; /** * Returns block details for the given block hash. */ getBlockByHash(blockHash: string): Promise<EvmBlockResponse>; /** * Returns block details for the given block height. */ getBlockByHeight(blockHeight: string): Promise<EvmBlockByHeightResponse>; /** * Returns the latest block number and hash. */ getLatestBlock(): Promise<EvmLatestBlockResponse>; /** * Estimates the gas required for a transaction. */ estimateGas(params: { addressFrom: string; addressTo: string; nonce: string; amount: string; data?: string; }): Promise<EvmEstimateGasResponse>; /** * Returns the current fee rate recommendations (low, normal, high, maximum). * * Each tier contains EIP-1559 fee parameters (`maxFeePerGasGwei`, * `maxPriorityFeePerGasGwei`) and an estimated confirmation time. */ getFeeRate(): Promise<EvmFeeRateResponse>; /** * Returns current network status including block time, gas usage, and fee predictions. */ getNetworkStatus(): Promise<EvmNetworkStatusResponse>; /** * Returns the URL endpoint for the SVG logo of this EVM network. */ getLogoUrl(): string; /** * Returns metadata and on-chain information for a token contract. */ getTokenData(contractAddress: string): Promise<EvmTokenDataResponse>; /** * Returns the URL endpoint for a token contract logo (PNG or SVG). */ getTokenLogoUrl(address: string): string; /** * Returns the full decoded metadata for a specific NFT token. */ getNftMetadata(contractAddress: string, tokenId: string): Promise<EvmNftMetadataResponse>; /** * Returns the URL endpoint for a specific NFT token image. */ getNftImageUrl(contractAddress: string, tokenId: string): string; /** * Returns the URL endpoint for a specific NFT token animation/video. */ getNftAnimationUrl(contractAddress: string, tokenId: string): string; /** * Broadcasts a signed raw transaction to the EVM network. */ broadcastTransaction(transactionRaw: string): Promise<EvmBroadcastTxResponse>; /** * Executes a read-only (eth_call) call against a smart contract. */ callSmartContract(body: EvmCallContractBody): Promise<EvmCallContractResponse>; }