@mr-zwets/bchn-api-wrapper
Version:
a Typescript wrapper for interacting with the Bitcoin Cash Node (BCHN) API
18 lines (17 loc) • 1.4 kB
TypeScript
import type { RestClientConfig, formatOptions, ResponseType } from "./interfaces/interfaces.js";
import type { BlockInfoNoTxDetails, BlockInfoTxDetails, ChainInfo, HeaderInfo, MempoolContent, MempoolInfo, TxDetails, UtxosInfo } from "./interfaces/restInterfaces/interfaces.js";
export declare class BchnRestClient {
private baseUrl;
private timeoutMs;
private logger;
constructor(config: RestClientConfig);
private fetchFromNode;
getTransaction<TFormat extends formatOptions = 'json'>(txid: string, format?: TFormat): Promise<ResponseType<TFormat, TxDetails>>;
getBlock<TFormat extends formatOptions = 'json'>(blockhash: string, includeTxDetails: true, format?: TFormat): Promise<TFormat extends 'json' ? BlockInfoTxDetails : string>;
getBlock<TFormat extends formatOptions = 'json'>(blockhash: string, includeTxDetails: false, format?: TFormat): Promise<TFormat extends 'json' ? BlockInfoNoTxDetails : string>;
getBlockHeaders<TFormat extends formatOptions = 'json'>(count: number, blockhash: string, format?: TFormat): Promise<ResponseType<TFormat, HeaderInfo>>;
getChainInfo(): Promise<ChainInfo>;
getUTXOs<TFormat extends formatOptions = 'json'>(checkmempool: boolean, outpoints: string[], format?: TFormat): Promise<ResponseType<TFormat, UtxosInfo>>;
getMempoolInfo(): Promise<MempoolInfo>;
getMempoolContents(): Promise<MempoolContent>;
}