import BigNumber from 'bignumber.js'; import { ApiClient } from '../.'; /** * Blockchain RPCs for DeFi Blockchain */ export declare class Blockchain { private readonly client; constructor(client: ApiClient); /** * Get various state info regarding blockchain processing. * * @return {Promise} */ getBlockchainInfo(): Promise; /** * Get a hash of block in best-block-chain at height provided. * * @param {number} height * @return {Promise} */ getBlockHash(height: number): Promise; /** * Get the height of the most-work fully-validated chain. * * @return {Promise} */ getBlockCount(): Promise; /** * Get block string hex with a provided block header hash. * * @param {string} hash of the block * @param {number} verbosity 0 * @return {Promise} block as string that is serialized, hex-encoded data */ getBlock(hash: string, verbosity: 0): Promise; /** * Get block data with a provided block header hash. * * @param {string} hash of the block * @param {number} verbosity 1 * @return {Promise>} block information with transaction as txid */ getBlock(hash: string, verbosity: 1): Promise>; /** * Get block data with a provided block header hash. * * @param {string} hash of the block * @param {number} verbosity 2 * @return {Promise>} block information and detailed information about each transaction. */ getBlock(hash: string, verbosity: 2): Promise>; /** * Get block header data with particular header hash. * Returns an Object with information for block header. * * @param {string} hash of the block * @param {boolean} verbosity true * @return {Promise} */ getBlockHeader(hash: string, verbosity: true): Promise; /** * Get block header data with particular header hash. * Returns a string that is serialized, hex-encoded data for block header. * * @param {string} hash of the block * @param {boolean} verbosity false * @return {Promise} */ getBlockHeader(hash: string, verbosity: false): Promise; /** * Return information about all known tips in the block tree * including the main chain as well as orphaned branches. * * @return {Promise} */ getChainTips(): Promise; /** * Get the proof-of-work difficulty as a multiple of the minimum difficulty. * * @return {Promise} */ getDifficulty(): Promise; /** * Get details of unspent transaction output (UTXO). * * @param {string} txId the transaction id * @param {number} index vout number * @param {boolean} includeMempool default true, whether to include mempool * @return {Promise} */ getTxOut(txId: string, index: number, includeMempool?: boolean): Promise; /** * Returns statistics about the unspent transaction output set. * Note this call may take some time. * * @return {Promise} */ getTxOutSetInfo(): Promise; /** * Get all transaction ids in memory pool as string * * @param {boolean} verbose false * @return {Promise} */ getRawMempool(verbose: false): Promise; /** * Get all transaction ids in memory pool as json object * * @param {boolean} verbose true * @return {Promise} */ getRawMempool(verbose: true): Promise; /** * Get all in-mempool ancestors for a given transaction as string[] * * @param {string} txId the transaction id * @param {boolean} verbose false * @return {Promise} */ getMempoolAncestors(txId: string, verbose?: false): Promise; /** * Get all in-mempool ancestors for a given transaction as json object * * @param {string} txId the transaction id * @param {boolean} verbose true * @return {Promise} */ getMempoolAncestors(txId: string, verbose?: true): Promise; /** * Get all in-mempool descendants for a given transaction as string[] * * @param {string} txId the transaction id * @param {boolean} verbose false * @return {Promise} */ getMempoolDescendants(txId: string, verbose?: false): Promise; /** * Get all in-mempool descendants for a given transaction as json object * * @param {string} txId the transaction id * @param {boolean} verbose true * @return {Promise} */ getMempoolDescendants(txId: string, verbose?: true): Promise; /** * Get mempool data for the given transaction * @param {string} txId the transaction id * @return {Promise} */ getMempoolEntry(txId: string): Promise; /** * Get block statistics for a given window. * * @param {number} hashOrHeight The block hash or height of the target block. * @param {Array} stats Default = all values. See BlockStats Interface. * @return {Promise} */ getBlockStats(hashOrHeight: number | string, stats?: Array): Promise; /** * Get the hash of the best (tip) block in the most-work fully-validated chain. * * @returns {Promise} */ getBestBlockHash(): Promise; /** * Returns details on the active state of the TX memory pool. * * @return {Promise} */ getMempoolInfo(): Promise; /** * Wait for any new block * * @param {number} [timeout=30000] in millis * @return Promise the current block on timeout or exit */ waitForNewBlock(timeout?: number): Promise; /** * Waits for a specific new block and returns useful info about it. * * @param {string} blockhash Block hash to wait for. * @param {number} [timeout=30000] in millis * @return Promise the current block on timeout or exit */ waitForBlock(blockhash: string, timeout?: number): Promise; /** * Waits for block height equal or higher than provided and returns the height and hash of the current tip. * * * @param {number} height * @param {number} [timeout=30000] in millis * @return Promise the current block on timeout or exit */ waitForBlockHeight(height: number, timeout?: number): Promise; /** * Get statistics about the total number and rate of transactions in the chain. * * @param {number} [nBlocks] size of the window in number of blocks. Defaults to 1 month (~86,400) blocks. * @param {string} [blockHash] the hash of the block that ends the window. Defaults to the chain tip. * @return {Promise} */ getChainTxStats(nBlocks?: number, blockHash?: string): Promise; } /** * TODO(fuxingloh): defid prune=1 is not type supported yet */ export interface BlockchainInfo { chain: 'main' | 'test' | 'regtest' | string; blocks: number; headers: number; bestblockhash: string; difficulty: number; mediantime: number; verificationprogress: number; initialblockdownload: boolean; chainwork: string; size_on_disk: number; pruned: boolean; softforks: { [id: string]: { type: 'buried' | 'bip9'; active: boolean; height: number; }; }; warnings: string; } export interface Block { hash: string; confirmations: number; strippedsize: number; size: number; weight: number; height: number; masternode: string; minter: string; mintedBlocks: number; stakeModifier: string; version: number; versionHex: string; merkleroot: string; time: number; mediantime: number; bits: string; difficulty: number; chainwork: string; tx: T[]; nTx: number; previousblockhash: string; nextblockhash: string; } export interface BlockHeader { hash: string; confirmations: number; height: number; version: number; versionHex: string; merkleroot: string; time: number; mediantime: number; bits: string; difficulty: number; chainwork: string; nTx: number; previousblockhash: string; nextblockhash: string; } export interface Transaction { txid: string; hash: string; version: number; size: number; vsize: number; weight: number; locktime: number; vin: Vin[]; vout: Vout[]; hex: string; } export interface Vin { coinbase?: string; txid: string; vout: number; scriptSig: { asm: string; hex: string; }; txinwitness?: string[]; sequence: string; } export interface Vout { value: BigNumber; n: number; scriptPubKey: ScriptPubKey; tokenId: number; } export interface UTXODetails { bestblock: string; confirmations: number; value: BigNumber; scriptPubKey: ScriptPubKey; coinbase: boolean; } export interface TxOutSetInfo { height: number; bestblock: string; transactions: Number; txouts: Number; bogosize: Number; hash_serialized_2: string; disk_size: Number; total_amount: BigNumber; } export interface ScriptPubKey { asm: string; hex: string; type: string; reqSigs: number; addresses: string[]; } export interface ChainTip { height: number; hash: string; branchlen: number; status: string; } export interface MempoolTx { [key: string]: { vsize: BigNumber; /** * @deprecated same as vsize. Only returned if defid is started with -deprecatedrpc=size */ size: BigNumber; weight: BigNumber; fee: BigNumber; modifiedfee: BigNumber; time: BigNumber; height: BigNumber; descendantcount: BigNumber; descendantsize: BigNumber; descendantfees: BigNumber; ancestorcount: BigNumber; ancestorsize: BigNumber; ancestorfees: BigNumber; wtxid: string; fees: { base: BigNumber; modified: BigNumber; ancestor: BigNumber; descendant: BigNumber; }; depends: string[]; spentby: string[]; 'bip125-replaceable': boolean; }; } export interface BlockStats { avgfee: number; avgfeerate: number; avgtxsize: number; blockhash: string; height: number; ins: number; maxfee: number; maxfeerate: number; maxtxsize: number; medianfee: number; mediantime: number; mediantxsize: number; minfee: number; minfeerate: number; mintxsize: number; outs: number; subsidy: number; swtxs: number; time: number; totalfee: number; txs: number; swtotal_size: number; swtotal_weight: number; total_out: number; total_size: number; total_weight: number; utxo_increase: number; utxo_size_inc: number; feerate_percentiles: [number, number, number, number, number]; } export interface MempoolInfo { loaded: boolean; size: number; bytes: number; usage: number; maxmempool: number; mempoolminfee: BigNumber; minrelaytxfee: BigNumber; } export interface WaitBlockResult { hash: string; height: number; } export interface ChainTxStats { time: number; txcount: number; window_final_block_hash: string; window_final_block_height: number; window_block_count: number; window_tx_count: number; window_interval: number; txrate: number; } //# sourceMappingURL=blockchain.d.ts.map