UNPKG

caravan-x

Version:

A terminal-based utility for managing Caravan multisig wallets in regtest mode. This tool simplifies development and testing with Caravan by providing an easy-to-use interface

103 lines (102 loc) 2.94 kB
import { BitcoinRpcClient } from "../../core/rpc"; import { Block, Transaction, MempoolInfo, NetworkInfo, ChainInfo, BlockchainVisualizationResponse } from "../types/types"; /** * Service for fetching blockchain data for visualization */ export declare class BlockchainDataService { private readonly rpc; private cachedTxCount; private lastBlockHeight; constructor(rpc: BitcoinRpcClient); /** * Get basic chain information */ getChainInfo(): Promise<ChainInfo>; /** * Get network information */ getNetworkInfo(): Promise<NetworkInfo>; /** * Get mempool information */ getMempoolInfo(): Promise<MempoolInfo>; /** * Get mempool transactions */ getMempoolTransactions(): Promise<string[]>; /** * Get block count */ getBlockCount(): Promise<number>; /** * Get a specific block by hash */ getBlock(hash: string, verbosity?: number): Promise<Block>; /** * Get a block by height */ getBlockByHeight(height: number, verbosity?: number): Promise<Block>; /** * Get the most recent blocks */ getRecentBlocks(count?: number): Promise<Block[]>; /** * Get a new address from a wallet */ getNewAddress(wallet: string): Promise<string>; /** * Get detailed transaction information */ getTransaction(txid: string): Promise<Transaction>; /** * Get mining info */ getMiningInfo(): Promise<any>; /** * Get wallet list */ getWalletList(): Promise<string[]>; /** * Get UTXO set statistics */ getUTXOStats(): Promise<any>; /** * Get blockchain data for visualization * Combines multiple queries for a complete visualization dataset */ getBlockchainVisualizationData(blockCount?: number): Promise<BlockchainVisualizationResponse>; /** * Extract miner information from coinbase transaction */ private extractMinerInfo; /** * Calculate estimated block fee */ private calculateBlockFee; /** * Calculate mempool fees */ private calculateMempoolFees; /** * Calculate total transaction count (approximate) */ private calculateTotalTxCount; /** * Mine blocks - implementation for the real-time visualization */ mineBlocks(numBlocks: number, address?: string): Promise<string[]>; /** * Create transaction - implementation for the real-time visualization */ createTransaction(fromWallet: string, toAddress: string, amount: number): Promise<any>; /** * Check for new blocks since last check * Returns the new block if one was found */ checkForNewBlocks(): Promise<Block | null>; /** * Check for new mempool transactions * Returns an array of new transaction IDs */ checkForNewMempoolTransactions(previousTxids: string[]): Promise<string[]>; }