import { type Network } from 'bitcoinjs-lib'; import type { ParsedTransaction } from '../../types'; /** * Utility class for parsing PSBTs and finalized Bitcoin transactions */ export declare class PsbtParser { /** * Parse a PSBT or finalized transaction and extract transaction information * Auto-detects format (hex/base64) and type (PSBT/finalized transaction) * @param psbtInput - The PSBT or finalized transaction in Base64 or hex format * @param network - Network used to encode the extracted addresses. Scripts are * network-agnostic, so passing the wrong one silently renders a valid address * under the wrong prefix (a testnet output shown as `bc1…`). * @returns Parsed transaction data with inputs and outputs * @throws Error if parsing fails */ static parsePsbt(psbtInput: string, network?: Network): ParsedTransaction; /** * Parse a PSBT or finalized transaction from hex format * @param psbtHex - The PSBT or finalized transaction in hex format * @returns Parsed transaction data with inputs and outputs * @throws Error if parsing fails */ static parseHexPsbt(psbtHex: string, network?: Network): ParsedTransaction; /** * Parse a PSBT or finalized transaction from base64 format * @param psbtBase64 - The PSBT or finalized transaction in base64 format * @returns Parsed transaction data with inputs and outputs * @throws Error if parsing fails */ static parseBase64Psbt(psbtBase64: string, network?: Network): ParsedTransaction; /** * Extract transaction data from a PSBT * Shared logic used by both parseHexPsbt and parseBase64Psbt * @param psbt - The parsed PSBT object * @returns Parsed transaction data with inputs and outputs */ private static extractPsbtData; /** * Extract outputs from transaction outputs * Shared logic used by both PSBT and finalized transaction parsing * @param txOutputs - Array of transaction outputs (from PSBT or Transaction) * @param outputs - Array to populate with parsed output data */ private static extractOutputs; /** * Parse a finalized Bitcoin transaction from hex format * @param txHex - The transaction in hex format * @returns Parsed transaction data with inputs and outputs * @throws Error if parsing fails */ private static parseFinalizedTransactionHex; /** * Parse a finalized Bitcoin transaction from base64 format * @param txBase64 - The transaction in base64 format * @returns Parsed transaction data with inputs and outputs * @throws Error if parsing fails */ private static parseFinalizedTransactionBase64; /** * Extract transaction data from a finalized Transaction * Shared logic used by both parseFinalizedTransactionHex and parseFinalizedTransactionBase64 * @param tx - The parsed Transaction object * @returns Parsed transaction data with inputs and outputs */ private static extractTransactionData; }