UNPKG

@btc-helpers/rpc

Version:

A somewhat typesafe Bitcoin RPC library

458 lines 85.3 kB
export interface RpcCallSpec { /** Mark in-wallet transaction <txid> as abandoned. This will mark this transaction and all its in-wallet descendants as abandoned which will allow. for their inputs to be respent. It can be used to replace "stuck" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already abandoned. https://developer.bitcoin.org/reference/rpc/abandontransaction.html */ abandontransaction: ({ txid, }: { /** `string` The transaction id — required */ txid: string; }) => Promise<any>; /** Stops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call. Note: Use "getwalletinfo" to query the scanning progress. https://developer.bitcoin.org/reference/rpc/abortrescan.html */ abortrescan: () => Promise<any>; /** Add an nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup. Each key is a Bitcoin address or hex-encoded public key. This functionality is only intended for use with non-watchonly addresses. See `importaddress` for watchonly p2sh address support. If 'label' is specified, assign address to that label. https://developer.bitcoin.org/reference/rpc/addmultisigaddress.html */ addmultisigaddress: ({ nrequired, keys, label, address_type, }?: { /** `numeric` The number of required signatures out of the n keys or addresses — required */ nrequired: number; /** `json array` The bitcoin addresses or hex-encoded public keys — required */ keys: any[]; /** `string` A label to assign the addresses to — defaults to `optional` */ label?: string; /** `string` The address type to use. Options are "legacy", "p2sh-segwit", and "bech32" — defaults to `set by -addresstype` */ address_type?: string; }) => Promise<any>; /** Attempts to add or remove a node from the addnode list. Or try a connection to a node once. Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be. full nodes/support SegWit as other outbound peers are (though such peers will not be synced from). https://developer.bitcoin.org/reference/rpc/addnode.html */ addnode: ({ node, command, }: { /** `string` The node (see getpeerinfo for nodes) — required */ node: string; /** `string` 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once — required */ command: string; }) => Promise<any>; /** Analyzes and provides information about the current status of a PSBT and its inputs. https://developer.bitcoin.org/reference/rpc/analyzepsbt.html */ analyzepsbt: ({ psbt, }: { /** `string` A base64 string of a PSBT — required */ psbt: string; }) => Promise<any>; /** Safely copies current wallet file to destination, which can be a directory or a path with filename. https://developer.bitcoin.org/reference/rpc/backupwallet.html */ backupwallet: ({ destination, }: { /** `string` The destination directory or file — required */ destination: string; }) => Promise<any>; /** Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B. An opt-in RBF transaction with the given txid must be in the wallet. The command will pay the additional fee by reducing change outputs or adding inputs when necessary. It may add a new change output if one does not already exist. All inputs in the original transaction will be included in the replacement transaction. The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs. By default, the new fee will be calculated automatically using the estimatesmartfee RPC. The user can specify a confirmation target for estimatesmartfee. Alternatively, the user can specify a fee rate in sat/vB for the new transaction. At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee. returned by getnetworkinfo) to enter the node's mempool. * WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. *. https://developer.bitcoin.org/reference/rpc/bumpfee.html */ bumpfee: ({ txid, options, }?: { /** `string` The txid to be bumped — required */ txid: string; /** `json object` defaults to `optional` */ options?: any; }) => Promise<any>; /** Clear all banned IPs. https://developer.bitcoin.org/reference/rpc/clearbanned.html */ clearbanned: () => Promise<any>; /** Combine multiple partially signed Bitcoin transactions into one transaction. Implements the Combiner role. https://developer.bitcoin.org/reference/rpc/combinepsbt.html */ combinepsbt: ({ txs, }: { /** `json array` The base64 strings of partially signed transactions — required */ txs: any[]; }) => Promise<any>; /** Combine multiple partially signed transactions into one transaction. The combined transaction may be another partially signed transaction or a . fully signed transaction. Arguments:. 1. txs (json array, required) The hex strings of partially signed transactions. [. "hexstring", (string) A hex-encoded raw transaction. ... ]. https://developer.bitcoin.org/reference/rpc/combinerawtransaction.html */ combinerawtransaction: ({ txs, }: { /** `json array` The hex strings of partially signed transactions — required */ txs: any[]; }) => Promise<any>; /** Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction. createpsbt and walletcreatefundedpsbt should be used for new applications. https://developer.bitcoin.org/reference/rpc/converttopsbt.html */ converttopsbt: ({ hexstring, permitsigdata, iswitness, }?: { /** `string` The hex string of a raw transaction — required */ hexstring: string; /** `boolean` If true, any signatures in the input will be discarded and conversion — defaults to `false` */ permitsigdata?: boolean; /** `boolean` Whether the transaction hex is a serialized witness transaction — defaults to `depends on heuristic tests` */ iswitness?: boolean; }) => Promise<any>; /** Creates a multi-signature address with n signature of m keys required. It returns a json object with the address and redeemScript. https://developer.bitcoin.org/reference/rpc/createmultisig.html */ createmultisig: ({ nrequired, keys, address_type, }?: { /** `numeric` The number of required signatures out of the n keys — required */ nrequired: number; /** `json array` The hex-encoded public keys — required */ keys: any[]; /** `string` The address type to use. Options are "legacy", "p2sh-segwit", and "bech32" — defaults to `legacy` */ address_type?: string; }) => Promise<any>; /** Creates a transaction in the Partially Signed Transaction format. Implements the Creator role. https://developer.bitcoin.org/reference/rpc/createpsbt.html */ createpsbt: ({ inputs, outputs, locktime, replaceable, }?: { /** `json array` The json objects — required */ inputs: any[]; /** `json array` The outputs (key-value pairs), where none of the keys are duplicated — required */ outputs: any[]; /** `numeric` Raw locktime. Non-0 value also locktime-activates inputs — defaults to `0` */ locktime?: number; /** `boolean` Marks this transaction as BIP125 replaceable — defaults to `false` */ replaceable?: boolean; }) => Promise<any>; /** Create a transaction spending the given inputs and creating new outputs. Outputs can be addresses or data. Returns hex-encoded raw transaction. Note that the transaction's inputs are not signed, and. it is not stored in the wallet or transmitted to the network. https://developer.bitcoin.org/reference/rpc/createrawtransaction.html */ createrawtransaction: ({ inputs, outputs, locktime, replaceable, }?: { /** `json array` The inputs — required */ inputs: any[]; /** `json array` The outputs (key-value pairs), where none of the keys are duplicated — required */ outputs: any[]; /** `numeric` Raw locktime. Non-0 value also locktime-activates inputs — defaults to `0` */ locktime?: number; /** `boolean` Marks this transaction as BIP125-replaceable — defaults to `false` */ replaceable?: boolean; }) => Promise<any>; /** Creates and loads a new wallet. https://developer.bitcoin.org/reference/rpc/createwallet.html */ createwallet: ({ wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup, }?: { /** `string` The name for the new wallet. If this is a path, the wallet will be created at the path location — required */ wallet_name: string; /** `boolean` Disable the possibility of private keys (only watchonlys are possible in this mode) — defaults to `false` */ disable_private_keys?: boolean; /** `boolean` Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed — defaults to `false` */ blank?: boolean; /** `string` Encrypt the wallet with this passphrase — defaults to `string` */ passphrase?: string; /** `boolean` Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind — defaults to `false` */ avoid_reuse?: boolean; /** `boolean` Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation — defaults to `false` */ descriptors?: boolean; /** `boolean` Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged — defaults to `null` */ load_on_startup?: boolean; }) => Promise<any>; /** Return a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction. https://developer.bitcoin.org/reference/rpc/decodepsbt.html */ decodepsbt: ({ psbt, }: { /** `string` The PSBT base64 string — required */ psbt: string; }) => Promise<any>; /** Return a JSON object representing the serialized, hex-encoded transaction. https://developer.bitcoin.org/reference/rpc/decoderawtransaction.html */ decoderawtransaction: ({ hexstring, iswitness, }?: { /** `string` The transaction hex string — required */ hexstring: string; /** `boolean` Whether the transaction hex is a serialized witness transaction — defaults to `depends on heuristic tests` */ iswitness?: boolean; }) => Promise<any>; /** Decode a hex-encoded script. https://developer.bitcoin.org/reference/rpc/decodescript.html */ decodescript: ({ hexstring, }: { /** `string` the hex-encoded script — required */ hexstring: string; }) => Promise<any>; /** Derives one or more addresses corresponding to an output descriptor. Examples of output descriptors are:. pkh(<pubkey>) P2PKH outputs for the given pubkey. wpkh(<pubkey>) Native segwit P2PKH outputs for the given pubkey. sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys. raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts. https://developer.bitcoin.org/reference/rpc/deriveaddresses.html */ deriveaddresses: ({ descriptor, range, }?: { /** `string` The descriptor — required */ descriptor: string; /** `numeric or array` If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive — defaults to `optional` */ range?: number | number[]; }) => Promise<any>; /** Immediately disconnects from the specified peer node. https://developer.bitcoin.org/reference/rpc/disconnectnode.html */ disconnectnode: ({ address, nodeid, }?: { /** `string` The IP address/port of the node — defaults to `fallback to nodeid` */ address?: string; /** `numeric` The node ID (see getpeerinfo for node IDs) — defaults to `fallback to address` */ nodeid?: number; }) => Promise<any>; /** Reveals the private key corresponding to 'address'. Then the importprivkey can be used with this output. https://developer.bitcoin.org/reference/rpc/dumpprivkey.html */ dumpprivkey: ({ address, }: { /** `string` The bitcoin address for the private key — required */ address: string; }) => Promise<any>; /** Dumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files. Imported scripts are included in the dumpfile, but corresponding BIP173 addresses, etc. may not be added automatically by importwallet. Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by. only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile). https://developer.bitcoin.org/reference/rpc/dumpwallet.html */ dumpwallet: ({ filename, }: { /** `string` The filename with path (absolute path recommended) — required */ filename: string; }) => Promise<any>; /** Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing . will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. https://developer.bitcoin.org/reference/rpc/encryptwallet.html */ encryptwallet: ({ passphrase, }: { /** `string` The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long — required */ passphrase: string; }) => Promise<any>; /** Estimates the approximate fee per kilobyte needed for a transaction to begin. confirmation within conf_target blocks if possible and return the number of blocks. for which the estimate is valid. Uses virtual transaction size as defined. in BIP 141 (witness data is discounted). https://developer.bitcoin.org/reference/rpc/estimatesmartfee.html */ estimatesmartfee: ({ conf_target, estimate_mode, }?: { /** `numeric` Confirmation target in blocks (1 - 1008) — required */ conf_target: number; /** `string` The fee estimate mode — defaults to `CONSERVATIVE` */ estimate_mode?: string; }) => Promise<any>; /** Arguments:. 1. psbt (string, required) A base64 string of a PSBT. 2. extract (boolean, optional, default=true) If true and the transaction is complete,. extract and return the complete transaction in normal network serialization instead of the PSBT. https://developer.bitcoin.org/reference/rpc/finalizepsbt.html */ finalizepsbt: ({ psbt, extract, }?: { /** `string` A base64 string of a PSBT — required */ psbt: string; /** `boolean` If true and the transaction is complete, — defaults to `true` */ extract?: boolean; }) => Promise<any>; /** If the transaction has no inputs, they will be automatically selected to meet its out value. It will add at most one change output to the outputs. No existing outputs will be modified unless "subtractFeeFromOutputs" is specified. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransactionwithkey. or signrawtransactionwithwallet for that. Note that all existing inputs must have their previous output transaction be in the wallet. Note that all inputs selected must be of standard form and P2SH scripts must be. in the wallet using importaddress or addmultisigaddress (to calculate fees). You can see whether this is the case by checking the "solvable" field in the listunspent output. Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only. https://developer.bitcoin.org/reference/rpc/fundrawtransaction.html */ fundrawtransaction: ({ hexstring, options, iswitness, }?: { /** `string` The hex string of the raw transaction — required */ hexstring: string; /** `json object` for backward compatibility: passing in a true instead of an object will result in {"includeWatching":true} — defaults to `optional` */ options?: any; /** `boolean` Whether the transaction hex is a serialized witness transaction — defaults to `depends on heuristic tests` */ iswitness?: boolean; }) => Promise<any>; /** Mine a block with a set of ordered transactions immediately to a specified address or descriptor (before the RPC call returns). https://developer.bitcoin.org/reference/rpc/generateblock.html */ generateblock: ({ output, transactions, }: { /** `string` The address or descriptor to send the newly generated bitcoin to — required */ output: string; /** `json array` An array of hex strings which are either txids or raw transactions — required */ transactions: any[]; }) => Promise<any>; /** Mine blocks immediately to a specified address (before the RPC call returns). https://developer.bitcoin.org/reference/rpc/generatetoaddress.html */ generatetoaddress: ({ nblocks, address, maxtries, }?: { /** `numeric` How many blocks are generated immediately — required */ nblocks: number; /** `string` The address to send the newly generated bitcoin to — required */ address: string; /** `numeric` How many iterations to try — defaults to `1000000` */ maxtries?: number; }) => Promise<any>; /** Mine blocks immediately to a specified descriptor (before the RPC call returns). https://developer.bitcoin.org/reference/rpc/generatetodescriptor.html */ generatetodescriptor: ({ num_blocks, descriptor, maxtries, }?: { /** `numeric` How many blocks are generated immediately — required */ num_blocks: number; /** `string` The descriptor to send the newly generated bitcoin to — required */ descriptor: string; /** `numeric` How many iterations to try — defaults to `1000000` */ maxtries?: number; }) => Promise<any>; /** Returns information about the given added node, or all added nodes. (note that onetry addnodes are not listed here). https://developer.bitcoin.org/reference/rpc/getaddednodeinfo.html */ getaddednodeinfo: ({ node, }?: { /** `string` If provided, return information about this specific node, otherwise all nodes are returned — defaults to `all nodes` */ node?: string; }) => Promise<any>; /** Returns the list of addresses assigned the specified label. https://developer.bitcoin.org/reference/rpc/getaddressesbylabel.html */ getaddressesbylabel: ({ label, }: { /** `string` The label — required */ label: string; }) => Promise<any>; /** Return information about the given bitcoin address. Some of the information will only be present if the address is in the active wallet. https://developer.bitcoin.org/reference/rpc/getaddressinfo.html */ getaddressinfo: ({ address, }: { /** `string` The bitcoin address for which to get information — required */ address: string; }) => Promise<any>; /** Returns the total available balance. The available balance is what the wallet considers currently spendable, and is. thus affected by options which limit spendability such as -spendzeroconfchange. https://developer.bitcoin.org/reference/rpc/getbalance.html */ getbalance: ({ dummy, minconf, include_watchonly, avoid_reuse, }?: { /** `string` Remains for backward compatibility. Must be excluded or set to "*" — defaults to `optional` */ dummy?: string; /** `numeric` Only include transactions confirmed at least this many times — defaults to `0` */ minconf?: number; /** `boolean` Also include balance in watch-only addresses (see 'importaddress') — defaults to `otherwise false` */ include_watchonly?: boolean; /** `boolean` (only available if avoid_reuse wallet flag is set) Do not include balance in dirty outputs; addresses are considered dirty if they have previously been used in a transaction — defaults to `true` */ avoid_reuse?: boolean; }) => Promise<any>; /** Result:. { (json object). "mine" : { (json object) balances from outputs that the wallet can sign. "trusted" : n, (numeric) trusted balance (outputs created by the wallet or confirmed outputs). "untrusted_pending" : n, (numeric) untrusted pending balance (outputs created by others that are in the mempool). "immature" : n, (numeric) balance from immature coinbase outputs. "used" : n (numeric) (only present if avoid_reuse is set) balance from coins sent to addresses that were previously spent from (potentially privacy violating). },. "watchonly" : { (json object) watchonly balances (not present if wallet does not watch anything). "trusted" : n, (numeric) trusted balance (outputs created by the wallet or confirmed outputs). "untrusted_pending" : n, (numeric) untrusted pending balance (outputs created by others that are in the mempool). "immature" : n (numeric) balance from immature coinbase outputs. }. }. https://developer.bitcoin.org/reference/rpc/getbalances.html */ getbalances: () => Promise<any>; /** Returns the hash of the best (tip) block in the most-work fully-validated chain. https://developer.bitcoin.org/reference/rpc/getbestblockhash.html */ getbestblockhash: () => Promise<any>; /** If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'. If verbosity is 1, returns an Object with information about block <hash>. If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. https://developer.bitcoin.org/reference/rpc/getblock.html */ getblock: ({ blockhash, verbosity, }?: { /** `string` The block hash — required */ blockhash: string; /** `numeric` 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data — defaults to `1` */ verbosity?: number; }) => Promise<any>; /** Result:. { (json object). "chain" : "str", (string) current network name (main, test, regtest). "blocks" : n, (numeric) the height of the most-work fully-validated chain. The genesis block has height 0. "headers" : n, (numeric) the current number of headers we have validated. "bestblockhash" : "str", (string) the hash of the currently best block. "difficulty" : n, (numeric) the current difficulty. "mediantime" : n, (numeric) median time for the current best block. "verificationprogress" : n, (numeric) estimate of verification progress [0..1]. "initialblockdownload" : true|false, (boolean) (debug information) estimate of whether this node is in Initial Block Download mode. "chainwork" : "hex", (string) total amount of work in active chain, in hexadecimal. "size_on_disk" : n, (numeric) the estimated size of the block and undo files on disk. "pruned" : true|false, (boolean) if the blocks are subject to pruning. "pruneheight" : n, (numeric) lowest-height complete block stored (only present if pruning is enabled). "automatic_pruning" : true|false, (boolean) whether automatic pruning is enabled (only present if pruning is enabled). "prune_target_size" : n, (numeric) the target size used by pruning (only present if automatic pruning is enabled). "softforks" : { (json object) status of softforks. "xxxx" : { (json object) name of the softfork. "type" : "str", (string) one of "buried", "bip9". "bip9" : { (json object) status of bip9 softforks (only for "bip9" type). "status" : "str", (string) one of "defined", "started", "locked_in", "active", "failed". "bit" : n, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for "started" status). "start_time" : xxx, (numeric) the minimum median time past of a block at which the bit gains its meaning. "timeout" : xxx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in. "since" : n, (numeric) height of the first block to which the status applies. "min_activation_height" : n, (numeric) minimum height of blocks for which the rules may be enforced. "statistics" : { (json object) numeric statistics about BIP9 signalling for a softfork (only for "started" status). "period" : n, (numeric) the length in blocks of the BIP9 signalling period. "threshold" : n, (numeric) the number of blocks with the version bit set required to activate the feature. "elapsed" : n, (numeric) the number of blocks elapsed since the beginning of the current period. "count" : n, (numeric) the number of blocks with the version bit set in the current period. "possible" : true|false (boolean) returns false if there are not enough blocks left in this period to pass activation threshold. }. },. "height" : n, (numeric) height of the first block which the rules are or will be enforced (only for "buried" type, or "bip9" type with "active" status). "active" : true|false (boolean) true if the rules are enforced for the mempool and the next block. },. ... },. "warnings" : "str" (string) any network and blockchain warnings. }. https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html */ getblockchaininfo: () => Promise<any>; /** Returns the height of the most-work fully-validated chain. The genesis block has height 0. https://developer.bitcoin.org/reference/rpc/getblockcount.html */ getblockcount: () => Promise<any>; /** Retrieve a BIP 157 content filter for a particular block. https://developer.bitcoin.org/reference/rpc/getblockfilter.html */ getblockfilter: ({ blockhash, filtertype, }?: { /** `string` The hash of the block — required */ blockhash: string; /** `string` The type name of the filter — defaults to `basic` */ filtertype?: string; }) => Promise<any>; /** Returns hash of block in best-block-chain at height provided. https://developer.bitcoin.org/reference/rpc/getblockhash.html */ getblockhash: ({ height, }: { /** `numeric` The height index — required */ height: number; }) => Promise<any>; /** If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'. If verbose is true, returns an Object with information about blockheader <hash>. https://developer.bitcoin.org/reference/rpc/getblockheader.html */ getblockheader: ({ blockhash, verbose, }?: { /** `string` The block hash — required */ blockhash: string; /** `boolean` true for a json object, false for the hex-encoded data — defaults to `true` */ verbose?: boolean; }) => Promise<any>; /** Compute per block statistics for a given window. All amounts are in satoshis. It won't work for some heights with pruning. https://developer.bitcoin.org/reference/rpc/getblockstats.html */ getblockstats: ({ hash_or_height, stats, }?: { /** `string or numeric` The block hash or height of the target block — required */ hash_or_height: string | number; /** `json array` Values to plot (see result below) — defaults to `all values` */ stats?: any[]; }) => Promise<any>; /** If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. For full specification, see BIPs 22, 23, 9, and 145:. https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki. https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki. https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes. https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki. https://developer.bitcoin.org/reference/rpc/getblocktemplate.html */ getblocktemplate: ({ template_request, }?: { /** `json object` Format of the template — defaults to `{}` */ template_request?: any; }) => Promise<any>; /** Result:. [ (json array). { (json object). "height" : n, (numeric) height of the chain tip. "hash" : "hex", (string) block hash of the tip. "branchlen" : n, (numeric) zero for main chain, otherwise length of branch connecting the tip to the main chain. "status" : "str" (string) status of the chain, "active" for the main chain. Possible values for status:. 1. "invalid" This branch contains at least one invalid block. 2. "headers-only" Not all blocks for this branch are available, but the headers are valid. 3. "valid-headers" All blocks are available for this branch, but they were never fully validated. 4. "valid-fork" This branch is not part of the active chain, but is fully validated. 5. "active" This is the tip of the active main chain, which is certainly valid. },. ... ]. https://developer.bitcoin.org/reference/rpc/getchaintips.html */ getchaintips: () => Promise<any>; /** Compute statistics about the total number and rate of transactions in the chain. https://developer.bitcoin.org/reference/rpc/getchaintxstats.html */ getchaintxstats: ({ nblocks, blockhash, }?: { /** `numeric` Size of the window in number of blocks — defaults to `one month` */ nblocks?: number; /** `string` The hash of the block that ends the window — defaults to `chain tip` */ blockhash?: string; }) => Promise<any>; /** Returns the number of connections to other nodes. https://developer.bitcoin.org/reference/rpc/getconnectioncount.html */ getconnectioncount: () => Promise<any>; /** Analyses a descriptor. https://developer.bitcoin.org/reference/rpc/getdescriptorinfo.html */ getdescriptorinfo: ({ descriptor, }: { /** `string` The descriptor — required */ descriptor: string; }) => Promise<any>; /** Returns the proof-of-work difficulty as a multiple of the minimum difficulty. https://developer.bitcoin.org/reference/rpc/getdifficulty.html */ getdifficulty: () => Promise<any>; /** Returns the status of one or all available indices currently running in the node. https://developer.bitcoin.org/reference/rpc/getindexinfo.html */ getindexinfo: ({ index_name, }?: { /** `string` Filter results for an index with a specific name — defaults to `optional` */ index_name?: string; }) => Promise<any>; /** Arguments:. 1. mode (string, optional, default="stats") determines what kind of information is returned. - "stats" returns general statistics about memory usage in the daemon. - "mallocinfo" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+). https://developer.bitcoin.org/reference/rpc/getmemoryinfo.html */ getmemoryinfo: ({ mode, }?: { /** `string` determines what kind of information is returned — defaults to `"stats"` */ mode?: string; }) => Promise<any>; /** If txid is in the mempool, returns all in-mempool ancestors. https://developer.bitcoin.org/reference/rpc/getmempoolancestors.html */ getmempoolancestors: ({ txid, verbose, }?: { /** `string` The transaction id (must be in mempool) — required */ txid: string; /** `boolean` True for a json object, false for array of transaction ids — defaults to `false` */ verbose?: boolean; }) => Promise<any>; /** If txid is in the mempool, returns all in-mempool descendants. https://developer.bitcoin.org/reference/rpc/getmempooldescendants.html */ getmempooldescendants: ({ txid, verbose, }?: { /** `string` The transaction id (must be in mempool) — required */ txid: string; /** `boolean` True for a json object, false for array of transaction ids — defaults to `false` */ verbose?: boolean; }) => Promise<any>; /** Returns mempool data for given transaction. https://developer.bitcoin.org/reference/rpc/getmempoolentry.html */ getmempoolentry: ({ txid, }: { /** `string` The transaction id (must be in mempool) — required */ txid: string; }) => Promise<any>; /** Returns details on the active state of the TX memory pool. https://developer.bitcoin.org/reference/rpc/getmempoolinfo.html */ getmempoolinfo: () => Promise<any>; /** Returns a json object containing mining-related information. Result:. { (json object). "blocks" : n, (numeric) The current block. "currentblockweight" : n, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled). "currentblocktx" : n, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled). "difficulty" : n, (numeric) The current difficulty. "networkhashps" : n, (numeric) The network hashes per second. "pooledtx" : n, (numeric) The size of the mempool. "chain" : "str", (string) current network name (main, test, regtest). "warnings" : "str" (string) any network and blockchain warnings. }. https://developer.bitcoin.org/reference/rpc/getmininginfo.html */ getmininginfo: () => Promise<any>; /** Returns information about network traffic, including bytes in, bytes out,. and current time. https://developer.bitcoin.org/reference/rpc/getnettotals.html */ getnettotals: () => Promise<any>; /** Returns the estimated network hashes per second based on the last n blocks. Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change. Pass in [height] to estimate the network speed at the time when a certain block was found. https://developer.bitcoin.org/reference/rpc/getnetworkhashps.html */ getnetworkhashps: ({ nblocks, height, }?: { /** `numeric` The number of blocks, or -1 for blocks since last difficulty change — defaults to `120` */ nblocks?: number; /** `numeric` To estimate at the time of the given height — defaults to `-1` */ height?: number; }) => Promise<any>; /** Result:. { (json object). "version" : n, (numeric) the server version. "subversion" : "str", (string) the server subversion string. "protocolversion" : n, (numeric) the protocol version. "localservices" : "hex", (string) the services we offer to the network. "localservicesnames" : [ (json array) the services we offer to the network, in human-readable form. "str", (string) the service name. ... ],. "localrelay" : true|false, (boolean) true if transaction relay is requested from peers. "timeoffset" : n, (numeric) the time offset. "connections" : n, (numeric) the total number of connections. "connections_in" : n, (numeric) the number of inbound connections. "connections_out" : n, (numeric) the number of outbound connections. "networkactive" : true|false, (boolean) whether p2p networking is enabled. "networks" : [ (json array) information per network. { (json object). "name" : "str", (string) network (ipv4, ipv6 or onion). "limited" : true|false, (boolean) is the network limited using -onlynet?. "reachable" : true|false, (boolean) is the network reachable?. "proxy" : "str", (string) ("host:port") the proxy that is used for this network, or empty if none. "proxy_randomize_credentials" : true|false (boolean) Whether randomized credentials are used. },. ... ],. "relayfee" : n, (numeric) minimum relay fee for transactions in BTC/kB. "incrementalfee" : n, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in BTC/kB. "localaddresses" : [ (json array) list of local addresses. { (json object). "address" : "str", (string) network address. "port" : n, (numeric) network port. "score" : n (numeric) relative score. },. ... ],. "warnings" : "str" (string) any network and blockchain warnings. }. https://developer.bitcoin.org/reference/rpc/getnetworkinfo.html */ getnetworkinfo: () => Promise<any>; /** Returns a new Bitcoin address for receiving payments. If 'label' is specified, it is added to the address book . so payments received with the address will be associated with 'label'. https://developer.bitcoin.org/reference/rpc/getnewaddress.html */ getnewaddress: ({ label, address_type, }?: { /** `string` The label name for the address to be linked to. It can also be set to the empty string "" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name — defaults to `""` */ label?: string; /** `string` The address type to use. Options are "legacy", "p2sh-segwit", and "bech32" — defaults to `set by -addresstype` */ address_type?: string; }) => Promise<any>; /** Return known addresses which can potentially be used to find new nodes in the network. https://developer.bitcoin.org/reference/rpc/getnodeaddresses.html */ getnodeaddresses: ({ count, }?: { /** `numeric` The maximum number of addresses to return. Specify 0 to return all known addresses — defaults to `1` */ count?: number; }) => Promise<any>; /** Returns data about each connected network node as a json array of objects. https://developer.bitcoin.org/reference/rpc/getpeerinfo.html */ getpeerinfo: () => Promise<any>; /** Returns a new Bitcoin address, for receiving change. This is for use with raw transactions, NOT normal use. https://developer.bitcoin.org/reference/rpc/getrawchangeaddress.html */ getrawchangeaddress: ({ address_type, }?: { /** `string` The address type to use. Options are "legacy", "p2sh-segwit", and "bech32" — defaults to `set by -changetype` */ address_type?: string; }) => Promise<any>; /** Returns all transaction ids in memory pool as a json array of string transaction ids. https://developer.bitcoin.org/reference/rpc/getrawmempool.html */ getrawmempool: ({ verbose, mempool_sequence, }?: { /** `boolean` True for a json object, false for array of transaction ids — defaults to `false` */ verbose?: boolean; /** `boolean` If verbose=false, returns a json object with transaction list and mempool sequence number attached — defaults to `false` */ mempool_sequence?: boolean; }) => Promise<any>; /** Return the raw transaction data. https://developer.bitcoin.org/reference/rpc/getrawtransaction.html */ getrawtransaction: ({ txid, verbose, blockhash, }?: { /** `string` The transaction id — required */ txid: string; /** `boolean` If false, return a string, otherwise return a json object — defaults to `false` */ verbose?: boolean; /** `string` The block in which to look for the transaction — defaults to `optional` */ blockhash?: string; }) => Promise<any>; /** Returns the total amount received by the given address in transactions with at least minconf confirmations. https://developer.bitcoin.org/reference/rpc/getreceivedbyaddress.html */ getreceivedbyaddress: ({ address, minconf, }?: { /** `string` The bitcoin address for transactions — required */ address: string; /** `numeric` Only include transactions confirmed at least this many times — defaults to `1` */ minconf?: number; }) => Promise<any>; /** Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations. https://developer.bitcoin.org/reference/rpc/getreceivedbylabel.html */ getreceivedbylabel: ({ label, minconf, }?: { /** `string` The selected label, may be the default label using "" — required */ label: string; /** `numeric` Only include transactions confirmed at least this many times — defaults to `1` */ minconf?: number; }) => Promise<any>; /** Returns details of the RPC server. https://developer.bitcoin.org/reference/rpc/getrpcinfo.html */ getrpcinfo: () => Promise<any>; /** Get detailed information about in-wallet transaction <txid>. https://developer.bitcoin.org/reference/rpc/gettransaction.html */ gettransaction: ({ txid, include_watchonly, verbose, }?: { /** `string` The transaction id — required */ txid: string; /** `boolean` Whether to include watch-only addresses in balance calculation and details[] — defaults to `otherwise false` */ include_watchonly?: boolean; /** `boolean` Whether to include a `decoded` field containing the decoded transaction (equivalent to RPC decoderawtransaction) — defaults to `false` */ verbose?: boolean; }) => Promise<any>; /** Returns details about an unspent transaction output. https://developer.bitcoin.org/reference/rpc/gettxout.html */ gettxout: ({ txid, n, include_mempool, }?: { /** `string` The transaction id — required */ txid: string; /** `numeric` vout number — required */ n: number; /** `boolean` Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear — defaults to `true` */ include_mempool?: boolean; }) => Promise<any>; /** Returns a hex-encoded proof that "txid" was included in a block. https://developer.bitcoin.org/reference/rpc/gettxoutproof.html */ gettxoutproof: ({ txids, blockhash, }?: { /** `json array` The txids to filter — required */ txids: any[]; /** `string` If specified, looks for txid in the block with this hash — defaults to `optional` */ blockhash?: string; }) => Promise<any>; /** Returns statistics about the unspent transaction output set. Note this call may take some time. https://developer.bitcoin.org/reference/rpc/gettxoutsetinfo.html */ gettxoutsetinfo: ({ hash_type, }?: { /** `string` Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'none' — defaults to `hash_serialized_2` */ hash_type?: string; }) => Promise<any>; /** https://developer.bitcoin.org/reference/rpc/getunconfirmedbalance.html */ getunconfirmedbalance: () => Promise<any>; /** Result:. { (json object). "walletname" : "str", (string) the wallet name. "walletversion" : n, (numeric) the wallet version. "format" : "str", (string) the database format (bdb or sqlite). "balance" : n, (numeric) DEPRECATED. Identical to getbalances().mine.trusted. "unconfirmed_balance" : n, (numeric) DEPRECATED. Identical to getbalances().mine.untrusted_pending. "immature_balance" : n, (numeric) DEPRECATED. Identical to getbalances().mine.immature. "txcount" : n, (numeric) the total number of transactions in the wallet. "keypoololdest" : xxx, (numeric) the UNIX epoch time of the oldest pre-generated key in the key pool. Legacy wallets only. "keypoolsize" : n, (numeric) how many new keys are pre-generated (only counts external keys). "keypoolsize_hd_internal" : n, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used). "unlocked_until" : xxx, (numeric, optional) the UNIX epoch time until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets). "paytxfee" : n, (numeric) the transaction fee configuration, set in BTC/kvB. "hdseedid" : "hex", (string, optional) the Hash160 of the HD seed (only present when HD is enabled). "private_keys_enabled" : true|false, (boolean) false if privatekeys are disabled for this wallet (enforced watch-only wallet). "avoid_reuse" : true|false, (boolean) whether this wallet tracks clean/dirty coins in terms of reuse. "scanning" : { (json object) current scanning details, or false if no scan is in progress. "duration" : n, (numeric) elapsed seconds since scan start. "progress" : n (numeric) scanning progress percentage [0.0, 1.0]. },. "descriptors" : true|false (boolean) whether this wallet uses descriptors for scriptPubKey management. }. https://developer.bitcoin.org/reference/rpc/getwalletinfo.html */ getwalletinfo: () => Promise<any>; /** Returns information about the active ZeroMQ notifications. https://developer.bitcoin.org/reference/rpc/getzmqnotifications.html */ getzmqnotifications: () => Promise<any>; /** List all commands, or get help for a specified command. https://developer.bitcoin.org/reference/rpc/help.html */ help: ({ command, }?: { /** `string` The command to get help on — defaults to `all commands` */ command?: string; }) => Promise<any>; /** Adds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup. https://developer.bitcoin.org/reference/rpc/importaddress.html */ importaddress: ({ address, label, rescan, }?: { /** `string` The Bitcoin address (or hex-encoded script) — required */ address: string; /** `string` An optional label — defaults to `""` */ label?: string; /** `boolean` Rescan the wallet for transactions — defaults to `true` */ rescan?: boolean; }) => Promise<any>; /** Import descriptors. This will trigger a rescan of the blockchain based on the earliest timestamp of all descriptors being imported. Requires a new wallet backup. https://developer.bitcoin.org/reference/rpc/importdescriptors.html */ importdescriptors: ({ requests, }: { /** `json array` Data to be imported — required */ requests: any[]; }) => Promise<any>; /** Import addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup. If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned. Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned. https://developer.bitcoin.org/reference/rpc/importmulti.html */ importmulti: ({ requests, options, }?: { /** `json array` Data to be imported — required */ requests: any[]; /** `json object` defaults to `optional` */ options?: any; }) => Promise<any>; /** Adds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup. Hint: use importmulti to import more than one private key. https://developer.bitcoin.org/reference/rpc/importprivkey.html */ importprivkey: ({ privkey, label, rescan, }?: { /** `string` The private key (see dumpprivkey) — required */ privkey: string; /** `string` An optional