UNPKG

@samouraiwallet/electrum-client

Version:
90 lines 5.22 kB
import { Client } from "./lib/client.js"; import type { Callbacks, CreateClientParams, ElectrumConfig, ElectrumRequestBatchParams, ElectrumRequestParams, PersistencePolicy, Protocol } from "./types"; export declare class ElectrumClient extends Client { private readonly onConnectCallback; private readonly onCloseCallback; private readonly onLogCallback; private timeLastCall; private persistencePolicy; private electrumConfig; private pingInterval; versionInfo: [string, string]; /** * Constructs an instance of ElectrumClient. * * @param {number} port - The port number to connect to. * @param {string} host - The host address to connect to. * @param {Protocol} protocol - The protocol to use for the connection. * @param {Callbacks} [callbacks] - Optional callbacks for connection events. */ constructor(port: number, host: string, protocol: Protocol, callbacks?: Callbacks); /** * Creates an instance of ElectrumClient and initializes it with the provided configuration. * * @param {CreateClientParams} params - The parameters required to create and initialize the client. * @param {number} params.port - The port number to connect to. * @param {string} params.host - The host address to connect to. * @param {Protocol} params.protocol - The protocol to use for the connection. * @param {Callbacks} [params.callbacks] - Optional callbacks for connection events. * @param {ElectrumConfig} params.electrumConfig - The Electrum configuration to use. * @param {PersistencePolicy} [params.persistencePolicy] - Optional persistence policy for the client. * * @returns {Promise<ElectrumClient>} A promise that resolves to an initialized ElectrumClient instance. */ static createClient(params: CreateClientParams): Promise<ElectrumClient>; /** * Initializes the Electrum client with the provided configuration and persistence policy. * * @param {ElectrumConfig} electrumConfig - The Electrum configuration to use. * @param {PersistencePolicy} [persistencePolicy] - Optional persistence policy for the client. * @returns {Promise<ElectrumClient>} A promise that resolves to the initialized ElectrumClient instance. */ initElectrum(electrumConfig: ElectrumConfig, persistencePolicy?: PersistencePolicy): Promise<ElectrumClient>; protected request<T>(method: string, params: ElectrumRequestParams<T>): Promise<unknown>; protected requestBatch<T>(method: string, params: ElectrumRequestParams<T>, secondParam?: ElectrumRequestBatchParams): Promise<unknown>; protected onClose(): void; private keepAlive; /** * Closes the Electrum client connection and stops the keep-alive ping interval. * * @returns {void} */ close(): void; private reconnect; private log; server_version(client_name: string, protocol_version: string | [string, string]): Promise<unknown>; server_banner(): Promise<unknown>; server_features(): Promise<unknown>; server_ping(): Promise<unknown>; server_addPeer(features: any): Promise<unknown>; serverDonation_address(): Promise<unknown>; serverPeers_subscribe(): Promise<unknown>; blockchainAddress_getProof(address: string): Promise<unknown>; blockchainScripthash_getBalance(scripthash: string): Promise<unknown>; blockchainScripthash_getBalanceBatch(scripthashes: string[]): Promise<unknown>; blockchainScripthash_listunspentBatch(scripthashes: string[]): Promise<unknown>; blockchainScripthash_getHistory(scripthash: string): Promise<unknown>; blockchainScripthash_getHistoryBatch(scripthashes: string[]): Promise<unknown>; blockchainScripthash_getMempool(scripthash: string): Promise<unknown>; blockchainScripthash_listunspent(scripthash: string): Promise<unknown>; blockchainScripthash_subscribe(scripthash: string): Promise<unknown>; blockchainBlock_getHeader(height: number): Promise<unknown>; blockchainBlock_headers(start_height: number, count: number): Promise<unknown>; blockchainEstimatefee(number: number): Promise<unknown>; blockchainHeaders_subscribe(): Promise<unknown>; blockchain_relayfee(): Promise<unknown>; blockchainTransaction_broadcast(rawtx: string): Promise<unknown>; blockchainTransaction_get(tx_hash: string, verbose?: boolean): Promise<unknown>; blockchainTransaction_getBatch(tx_hashes: string[], verbose?: boolean): Promise<unknown>; blockchainTransaction_getMerkle(tx_hash: string, height: number): Promise<unknown>; mempool_getFeeHistogram(): Promise<unknown>; blockchainUtxo_getAddress(tx_hash: string, index: number): Promise<unknown>; blockchainNumblocks_subscribe(): Promise<unknown>; blockchainBlock_getChunk(index: number): Promise<unknown>; blockchainAddress_getBalance(address: string): Promise<unknown>; blockchainAddress_getHistory(address: string): Promise<unknown>; blockchainAddress_getMempool(address: string): Promise<unknown>; blockchainAddress_listunspent(address: string): Promise<unknown>; blockchainAddress_subscribe(address: string): Promise<unknown>; } //# sourceMappingURL=index.d.ts.map