UNPKG

@devgrid/bitcoin-core

Version:
498 lines (497 loc) 14.1 kB
import type { EstimateMode, SendManyParams, BitcoinCoreConfig, SignatureHashType, BitcoinAddressType, CreateWalletOptions, SendToAddressParams } from './types'; export declare class BitcoinCore { private config; private url; private cache; private pendingRequests; constructor(config: BitcoinCoreConfig); getBestBlockhash(): Promise<string>; getBlock(params: { blockhash: string; verbosity?: number; }): Promise<{ [key: string]: any; } | string>; getBlockchainInfo(): Promise<any>; getBlockCount(): Promise<number>; getBlockFilter(params: { blockhash: string; filtertype?: string; }): Promise<any>; getBlockHash(params: { height: number; }): Promise<string>; getBlockHeader(params: { blockhash: string; verbose?: boolean; }): Promise<any>; getBlockStats(params: { hash_or_height: string | number; stats?: string[]; }): Promise<any>; getChainTips(): Promise<any>; getChainTxStats(params: { nblocks?: number; blockhash?: string; }): Promise<any>; getDifficulty(): Promise<number>; getMempoolAncestors(params: { txid: string; verbose?: boolean; }): Promise<any>; getMempoolDescendants(params: { txid: string; verbose?: boolean; }): Promise<any>; getMempoolEntry(params: { txid: string; }): Promise<any>; getMempoolInfo(): Promise<any>; getRawMempool(params: { verbose?: boolean; mempool_sequence?: boolean; }): Promise<any>; getTxOut(params: { txid: string; n: number; include_mempool?: boolean; }): Promise<any>; getTxOutProof(params: { txids: string[]; blockhash?: string; }): Promise<any>; getTxOutSetInfo(params: { hash_type?: string; hash_or_height?: string | number; use_index?: boolean; }): Promise<any>; preciousBlock(params: { blockhash: string; }): Promise<any>; pruneBlockChain(params: { height: number; }): Promise<any>; saveMempool(): Promise<any>; scanTxOutSet(params: { action: 'start' | 'abort' | 'status'; scanobjects?: any[]; }): Promise<any>; verifyChain(params: { checklevel?: 0 | 1 | 2 | 3 | 4; nblocks?: number; }): Promise<any>; verifyTxOutProof(params: { proof: string; }): Promise<any>; getMemoryInfo(params: { mode?: 'stats' | 'mallocinfo'; }): Promise<any>; getRpcInfo(): Promise<any>; help(params: { command?: string; }): Promise<any>; logging(params: { include?: string[]; exclude?: string[]; }): Promise<any>; stop(): Promise<any>; uptime(): Promise<number>; generateBlock(params: { output: string; transactions: string[]; submit?: boolean; }): Promise<string[]>; generateToAddress(params: { nblocks: number; address: string; maxtries?: number; }): Promise<string[]>; generateToDescriptor(params: { num_blocks: number; descriptor: string; maxtries?: number; }): Promise<string[]>; getBlockTemplate(params: { template_request: Record<string, any>; }): Promise<any>; getMiningInfo(): Promise<any>; getNetworkHashPs(params: { nblocks?: number; height?: number; }): Promise<number>; prioritizeTransaction(params: { txid: string; fee_delta: number; }): Promise<any>; submitBlock(params: { hexdata: string; dummy?: string; }): Promise<string | null>; submitHeader(params: { hexdata: string; }): Promise<any>; addNode(params: { node: string; command: 'add' | 'remove' | 'onetry'; v2transport?: boolean; }): Promise<null>; clearBanned(): Promise<null>; disconnectNode(params: { address?: string; nodeid?: number; }): Promise<null>; getAddedNodeInfo(params: { node?: string; }): Promise<any>; getConnectionCount(): Promise<number>; getNetTotals(): Promise<any>; getNetworkInfo(): Promise<any>; getNodeAddresses(params: { count?: number; network?: 'ipv4' | 'ipv6' | 'onion' | 'i2p' | 'cjdns'; }): Promise<any>; getPeerInfo(): Promise<any>; listBanned(): Promise<any>; ping(): Promise<any>; setBan(params: { subnet: string; command: 'add' | 'remove'; bantime?: number; absolute?: boolean; }): Promise<null>; setNetworkActive(params: { state: boolean; }): Promise<boolean>; analyzePsbt(params: { psbt: string; }): Promise<any>; combinePsbt(params: { txs: string[]; }): Promise<any>; combineRawTransaction(params: { txs: string[]; }): Promise<string>; convertToPsbt(params: { hexstring: string; permitsigdata?: boolean; iswitness?: boolean; }): Promise<any>; createPsbt(params: { inputs: any[]; outputs: any[]; locktime?: number; replaceable?: boolean; }): Promise<string>; createRawTransaction(params: { inputs: any[]; outputs: any[]; locktime?: number; replaceable?: boolean; }): Promise<string>; decodePsbt(params: { psbt: string; }): Promise<any>; decodeRawTransaction(params: { hexstring: string; iswitness?: boolean; }): Promise<any>; decodeScript(params: { hexstring: string; }): Promise<any>; finalizePsbt(params: { psbt: string; extract?: boolean; }): Promise<any>; fundRawTransaction(params: { hexstring: string; options?: any; iswitness?: boolean; }): Promise<any>; getRawTransaction(params: { txid: string; verbosity?: boolean; blockhash?: string; }): Promise<any>; joinPsbts(params: { txs: string[]; }): Promise<string>; sendRawTransaction(params: { hexstring: string; maxfeerate?: number | string; maxburnamount?: number | string; }): Promise<string>; signRawTransactionWithKey(params: { hexstring: string; privkeys: string[]; prevtxs?: any[]; sighashtype?: SignatureHashType; }): Promise<any>; testMempoolAccept(params: { rawtxs: string[]; maxfeerate?: number | string; }): Promise<any>; utxoUpdatePsbt(params: { psbt: string; descriptors?: any[]; }): Promise<string>; createMultisig(params: { nrequired: number; keys: string[]; address_type?: Omit<BitcoinAddressType, 'bech32m'>; }): Promise<any>; deriveAddresses(params: { descriptor: string; range?: number | number[]; }): Promise<string[]>; estimateSmartFee(params: { conf_target: number; estimate_mode?: EstimateMode; }): Promise<any>; getDescriptorInfo(params: { descriptor: string; }): Promise<any>; getIndexInfo(params: { index_name?: string; }): Promise<any>; signMessageWithPrivKey(params: { privkey: string; message: string; }): Promise<string>; validateAddress(params: { address: string; }): Promise<any>; verifyMessage(params: { address: string; signature: string; message: string; }): Promise<boolean>; abandonTransaction(params: { txid: string; }): Promise<void>; abortRescan(): Promise<void>; addMultiSigAddress(params: { nrequired: number; keys: string[]; label?: string; address_type?: Omit<BitcoinAddressType, 'bech32m'>; }): Promise<string>; backupWallet(params: { destination: string; }): Promise<void>; bumpFee(params: { txid: string; options?: any; }): Promise<any>; createWallet(params: CreateWalletOptions): Promise<{ name: string; }>; dumpPrivKey(params: { address: string; }): Promise<string>; dumpWallet(params: { filename: string; }): Promise<string>; encryptWallet(params: { passphrase: string; }): Promise<void>; getAddressesByLabel(params: { label: string; }): Promise<string[]>; getAddressInfo(params: { address: string; }): Promise<any>; getBalance(params: { dummy?: string; minconf?: number; include_watchonly?: boolean; avoid_reuse?: boolean; }): Promise<number>; getBalances(): Promise<any>; getNewAddress(params: { label?: string; address_type?: BitcoinAddressType; }, options?: { wallet?: string; }): Promise<string>; getRawChangeAddress(params: { address_type?: BitcoinAddressType; }): Promise<string>; getReceivedByAddress(params: { address: string; minconf?: number; include_immature_coinbase?: boolean; }): Promise<number>; getReceivedByLabel(params: { label: string; minconf?: number; include_immature_coinbase?: boolean; }): Promise<number>; getTransaction(params: { txid: string; include_watchonly?: boolean; verbose?: boolean; }): Promise<any>; getUnconfirmedBalance(): Promise<number>; getWalletInfo(): Promise<any>; importAddress(params: { address: string; label?: string; rescan?: boolean; p2sh?: boolean; }): Promise<void>; importDescriptors(params: { requests: any[]; }): Promise<void>; importMulti(params: { requests: any[]; options?: any; }): Promise<void>; importPrivKey(params: { privkey: string; label?: string; rescan?: boolean; }): Promise<null>; importPrunedFunds(params: { rawtransaction: string; txoutproof: string; }): Promise<void>; importPubKey(params: { pubkey: string; label?: string; rescan?: boolean; }): Promise<null>; importWallet(params: { filename: string; }): Promise<void>; keyPoolRefill(params: { newsize?: number; }): Promise<void>; listAddressGroupings(): Promise<any[]>; listLabels(params: { purpose?: 'send' | 'receive'; }): Promise<string[]>; listLockUnspent(): Promise<any[]>; listReceivedByAddress(params: { minconf?: number; include_empty?: boolean; include_watchonly?: boolean; address_filter?: string; include_immature_coinbase?: boolean; }): Promise<any[]>; listReceivedByLabel(params: { minconf?: number; include_empty?: boolean; include_watchonly?: boolean; include_immature_coinbase?: boolean; }): Promise<any[]>; listSinceBlock(params: { blockhash?: string; target_confirmations?: number; include_watchonly?: boolean; include_removed?: boolean; include_change?: boolean; label?: string; }): Promise<any>; listTransactions(params: { label?: string; count?: number; skip?: number; include_watchonly?: boolean; }): Promise<any[]>; listUnspent(params: { minconf?: number; maxconf?: number; addresses?: string[]; include_unsafe?: boolean; query_options?: any; }): Promise<any[]>; listWalletDir(): Promise<any[]>; listWallets(): Promise<string[]>; loadWallet(params: { filename: string; load_on_startup?: boolean; }): Promise<any>; lockUnspent(params: { unlock: boolean; transactions: any[]; }): Promise<void>; psbtBumpFee(params: { txid: string; options?: any; }): Promise<any>; removePrunedFunds(params: { txid: string; }): Promise<void>; rescanBlockchain(params: { start_height?: number; stop_height?: number; }): Promise<void>; send(params: { outputs: any[]; conf_target?: number; estimate_mode?: EstimateMode; fee_rate?: number | string; options?: any; }): Promise<string>; sendMany(params: SendManyParams): Promise<string>; sendToAddress(params: SendToAddressParams): Promise<string>; setHdSeed(params: { newkeypool?: boolean; seed?: string; }): Promise<void>; setLabel(params: { address: string; label: string; }): Promise<void>; setTxFee(params: { amount: number | string; }): Promise<boolean>; setWalletFlag(params: { flag: string; value?: boolean; }): Promise<void>; signMessage(params: { address: string; message: string; }): Promise<string>; signRawTransactionWithWallet(params: { hexstring: string; prevtxs?: any[]; sighashtype?: SignatureHashType; }): Promise<any>; unloadWallet(params: { wallet_name?: string; load_on_startup?: boolean; }): Promise<void>; upgradeWallet(params: { version?: number; }): Promise<void>; walletCreateFundedPsbt(params: { inputs?: any[]; outputs: any[]; locktime?: number; options?: any; bip32derivs?: boolean; }): Promise<any>; walletLock(): Promise<null>; walletPassphrase(params: { passphrase: string; timeout: number; }): Promise<null>; walletPassphraseChange(params: { oldpassphrase: string; newpassphrase: string; }): Promise<null>; walletProcessPsbt(params: { psbt: string; sign?: boolean; sighashtype?: SignatureHashType; bip32derivs?: boolean; finalize?: boolean; }): Promise<any>; callMethod(method: string, params?: Record<string, any>, options?: { wallet?: string; }): Promise<any>; private waitForNode; private makeRPCCall; }