UNPKG

rpc-bitcoin

Version:

A TypeScript library to make RPC and HTTP REST requests to Bitcoin Core

40 lines (39 loc) 1.27 kB
import { RPC, RPCOptions } from "rpc-request"; export declare type formatParam = { format?: "json" | "hex" | "bin"; }; export declare type BlockParams = formatParam & { hash: string; }; export declare type BlockHeightParams = formatParam & { height: number; }; export declare type Outpoint = { txid: string; n: number; }; export declare type UtxosParams = formatParam & { checkmempool?: boolean; outpoints: Outpoint[] | Outpoint; }; export declare type HeaderParams = BlockParams & { count?: number; }; export declare type TxParams = formatParam & { txid: string; }; export declare type RESTIniOptions = RPCOptions & { url?: string; }; export declare class RESTClient extends RPC { constructor({ url, port, timeout, ...options }?: RESTIniOptions); getBlock({ hash, format }: BlockParams): Promise<any>; getBlockNoTxDetails({ hash, format }: BlockParams): Promise<any>; getBlockHashByHeight({ height, format }: BlockHeightParams): Promise<any>; getChainInfo(): Promise<any>; getUtxos({ checkmempool, outpoints, format }: UtxosParams): Promise<any>; getHeaders({ count, hash, format }: HeaderParams): Promise<any>; getMemPoolContents(): Promise<any>; getMemPoolInfo(): Promise<any>; getTx({ txid, format }: TxParams): Promise<any>; }