UNPKG

@mr-zwets/bchn-api-wrapper

Version:

a Typescript wrapper for interacting with the Bitcoin Cash Node (BCHN) API

20 lines (19 loc) 728 B
import type { RpcClientConfig, RpcRequest } from "./interfaces/interfaces.js"; /** RPC client for full BCHN node interaction via JSON-RPC. */ export declare class BchnRpcClient { private url; private rpcUser; private rpcPassword; private maxRetries; private retryDelayMs; private logger; private timeoutMs; constructor(config: RpcClientConfig); /** * Sends a typed RPC request to the BCHN node. * @example * const result = await client.request<GetBlockCount>("getblockcount"); * const block = await client.request<GetBlockVerbosity1>("getblock", hash, 1); */ request<T extends RpcRequest>(endpoint: T['method'], ...params: T['params']): Promise<T['response']>; }