@btc-vision/bitcoin-rpc
Version:
The one and only fully typed Bitcoin RPC client for Node.js
85 lines (84 loc) • 5.63 kB
TypeScript
import { Logger } from '@btc-vision/bsi-common';
import { CreateWalletParams, GetChainTxStatsParams, RPCIniOptions, SendRawTransactionParams } from './external/rpc.js';
import { AddressByLabel } from './types/AddressByLabel.js';
import { RPCConfig } from './interfaces/RPCConfig.js';
import { BasicBlockInfo } from './types/BasicBlockInfo.js';
import { BitcoinRawTransactionParams, RawTransaction } from './types/BitcoinRawTransaction.js';
import { BitcoinVerbosity } from './types/BitcoinVerbosity.js';
import { BlockchainInfo } from './types/BlockchainInfo.js';
import { BlockData, BlockDataWithTransactionData } from './types/BlockData.js';
import { BlockFilterInfo } from './types/BlockFilterInfo.js';
import { BlockHeaderInfo } from './types/BlockHeaderInfo.js';
import { BlockStats } from './types/BlockStats.js';
import { ChainTipInfo } from './types/ChainTipInfo.js';
import { ChainTxStats } from './types/ChainTxStats.js';
import { CreateWalletResponse } from './types/CreateWalletResponse.js';
import { FeeEstimation, SmartFeeEstimation } from './types/FeeEstimation.js';
import { MempoolInfo } from './types/MempoolInfo.js';
import { MemPoolTransactionInfo, RawMemPoolTransactionInfo } from './types/MemPoolTransactionInfo.js';
import { TransactionOutputInfo } from './types/TransactionOutputInfo.js';
import { TransactionOutputSetInfo } from './types/TransactionOutputSetInfo.js';
import { WalletInfo } from './types/WalletInfo.js';
import { RawMempool } from './types/RawMempool.js';
export declare class BitcoinRPC extends Logger {
private readonly cacheClearInterval;
private readonly enableDebug;
readonly logColor: string;
private rpc;
private blockchainInfo;
private currentBlockInfo;
private purgeInterval;
constructor(cacheClearInterval?: number, enableDebug?: boolean);
destroy(): void;
getRpcConfigFromBlockchainConfig(rpcInfo: RPCConfig): RPCIniOptions;
getBestBlockHash(): Promise<string | null>;
getBlockBatch(blockHashes: string[]): Promise<BlockData[] | null>;
getBlockAsHexString(blockHash: string): Promise<string | null>;
estimateSmartFee(confTarget: number, estimateMode?: FeeEstimation): Promise<SmartFeeEstimation>;
joinPSBTs(psbts: string[]): Promise<string | null>;
getBlockInfoOnly(blockHash: string): Promise<BlockData | null>;
getBlockInfoWithTransactionData(blockHash: string): Promise<BlockDataWithTransactionData | null>;
getBlockHashes(height: number, count: number): Promise<(string | null)[] | null>;
getBlocksInfoWithTransactionData(blockHashes: string[]): Promise<(BlockDataWithTransactionData | null)[] | null>;
getBlockCount(): Promise<number | null>;
getBlockFilter(blockHash: string, filterType?: string): Promise<BlockFilterInfo | null>;
getBlockHash(height: number): Promise<string | null>;
getChainInfo(): Promise<BlockchainInfo | null>;
getWalletInfo(walletName: string): Promise<WalletInfo | null>;
createWallet(params: CreateWalletParams): Promise<CreateWalletResponse | null>;
loadWallet(filename: string): Promise<CreateWalletResponse | null>;
listWallets(): Promise<string[] | null>;
getNewAddress(label: string, wallet?: string): Promise<string | null>;
generateToAddress(nBlock: number, address: string, wallet?: string): Promise<string[] | null>;
importPrivateKey(privateKey: string, label: string, rescan?: boolean, wallet?: string): Promise<void>;
getAddressByLabel(label: string, wallet?: string): Promise<AddressByLabel | null>;
sendRawTransaction(params: SendRawTransactionParams): Promise<string | null>;
dumpPrivateKey(address: string, wallet?: string): Promise<string | null>;
getRawTransaction<V extends BitcoinVerbosity>(parameters: BitcoinRawTransactionParams): Promise<RawTransaction<V> | null>;
getRawTransactions<V extends BitcoinVerbosity>(txs: string[], verbose?: V): Promise<(RawTransaction<V> | null)[] | null>;
getBlockHeight(): Promise<BasicBlockInfo | null>;
getBlockHeader(blockHash: string, verbose?: boolean): Promise<BlockHeaderInfo | null>;
getBlockStatsByHeight(height: number, stats?: string[]): Promise<BlockStats | null>;
getBlockStatsByHash(blockHash: string, stats?: string[]): Promise<BlockStats | null>;
getChainTips(): Promise<ChainTipInfo[] | null>;
getChainTxStats(param: GetChainTxStatsParams): Promise<ChainTxStats | null>;
getDifficulty(): Promise<number | null>;
getMempoolAncestors<V extends BitcoinVerbosity>(txId: string, verbose?: V): Promise<MemPoolTransactionInfo<V> | null>;
getMempoolDescendants<V extends BitcoinVerbosity>(txid: string, verbose?: V): Promise<MemPoolTransactionInfo<V> | null>;
getMempoolEntry(txid: string): Promise<RawMemPoolTransactionInfo | null>;
getMempoolInfo(): Promise<MempoolInfo<BitcoinVerbosity.NONE> | null>;
getRawMempool<V extends BitcoinVerbosity>(verbose?: V): Promise<RawMempool<V> | null>;
getTxOut(txid: string, voutNumber: number, includeMempool?: boolean): Promise<TransactionOutputInfo | null>;
getTxOutProof(txids: string[], blockHash?: string): Promise<string | null>;
getTxOutSetInfo(): Promise<TransactionOutputSetInfo | null>;
preciousBlock(blockHash: string): Promise<void>;
pruneBlockChain(height: number): Promise<number | null>;
saveMempool(): Promise<void>;
verifyChain(checkLevel?: number, nblocks?: number): Promise<boolean | null>;
verifyTxOutProof(proof: string): Promise<string[] | null>;
init(rpcInfo: RPCConfig): Promise<void>;
error(...args: string[]): void;
private debugMessage;
private purgeCachedData;
private testRPC;
}