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

121 lines (120 loc) 4.27 kB
import type { Client } from '../Client/client'; import type { UtxoBlockResponse, UtxoBlockByHeightResponse, UtxoBroadcastTxResponse, UtxoEstimateSizeBody, UtxoEstimateSizeResponse, UtxoFeeRateResponse, UtxoLatestBlockResponse, UtxoMempoolResponseSchema, UtxoTxDetailsResponse } from '../Client'; import { Amount } from '../utils/Amount'; import type { ChainGateGlobal } from '../ChainGate/ChainGate'; export type UtxoNetwork = 'bitcoin' | 'litecoin' | 'dogecoin' | 'bitcoincash' | 'bitcointestnet'; export declare class UtxoExplorer { /** @internal */ readonly client: Client; /** @internal */ readonly network: UtxoNetwork; /** @internal */ readonly baseUrl: string; /** @internal */ readonly apiKey: string | undefined; /** @internal */ readonly global: ChainGateGlobal; constructor(client: Client, network: UtxoNetwork, baseUrl: string, apiKey: string | undefined, global: ChainGateGlobal); /** * Creates an Amount from a raw satoshi bigint value. * @internal */ amountFromSat(sat: bigint): Amount; /** Returns the native coin data for this network. */ private nativeData; /** * Returns the confirmed and unconfirmed balance for a UTXO address. * * The `confirmed` and `unconfirmed` fields are returned as `Amount` instances. */ getAddressBalance(address: string): Promise<{ address: string; confirmed: Amount; unconfirmed: Amount; }>; /** * Returns paginated transaction history for a UTXO address. * * Each transaction's `amount` and `addressBalance` are returned as `Amount` instances. */ getAddressHistory(address: string, page?: string): Promise<{ page: number; transactions: Array<{ height: number; txid: string; amount: Amount; addressBalance: Amount; }>; }>; /** * Returns paginated unspent transaction outputs (UTXOs) for a UTXO address. * * Each UTXO's `amount` is returned as an `Amount` instance. */ getUtxosByAddress(address: string, page?: string): Promise<{ address: string; page: number; utxos: Array<{ txid: string; n: number; amount: Amount; height: number; script: string; }>; }>; /** * Returns detailed information about a transaction by its ID. * * The `fee`, `feePerKb`, and all input/output `amount` fields are returned as `Amount` instances. */ getTransactionDetails(transactionId: string): Promise<Omit<UtxoTxDetailsResponse, 'fee' | 'feePerKb' | 'inputs' | 'outputs'> & { fee: Amount; feePerKb: Amount; inputs: Array<{ address?: string | null; amount: Amount; txId?: string | null; n?: number | null; script?: string | null; scriptSig?: string | null; }>; outputs: Array<{ address: string; amount: Amount; n: number; script: string; }>; }>; /** * Returns block details for the given block hash. */ getBlockByHash(blockHash: string): Promise<UtxoBlockResponse>; /** * Returns block details for the given block height. */ getBlockByHeight(blockHeight: string): Promise<UtxoBlockByHeightResponse>; /** * Returns the latest block number and hash. */ getLatestBlock(): Promise<UtxoLatestBlockResponse>; /** * Returns fee rate estimates for 4 priority tiers in satoshis per KB. */ getFeeRate(): Promise<UtxoFeeRateResponse>; /** * Returns paginated mempool transaction IDs. */ getMempool(page?: string): Promise<UtxoMempoolResponseSchema>; /** * Returns the URL endpoint for the SVG logo of this UTXO network. */ getLogoUrl(): string; /** * Broadcasts a signed raw transaction to the UTXO network. */ broadcastTransaction(transactionRaw: string): Promise<UtxoBroadcastTxResponse>; /** * Estimates the byte size of a transaction given inputs and outputs. */ estimateTransactionSize(body: UtxoEstimateSizeBody): Promise<UtxoEstimateSizeResponse>; }