UNPKG

@btc-stamps/tx-builder

Version:

Transaction builder for Bitcoin Stamps and SRC-20 tokens with advanced UTXO selection

904 lines (886 loc) 28.8 kB
import { Buffer } from 'node:buffer'; import * as bitcoin from 'bitcoinjs-lib'; import { Network } from 'bitcoinjs-lib'; import { l as SRC20Data, m as SRC20Operation, n as SRC20EncodingOptions, o as SRC20EncodingResult, b as SRC20DeployData, c as SRC20MintData, d as SRC20TransferData } from '../src20.interface-BFhaLcm9.js'; import '../protection.interface-DWbXoL2W.js'; import '../provider.interface-53Rg30ZJ.js'; /** * Base Encoder Type Definitions * * Core types for all encoder implementations */ /** * Base encoding result structure */ interface EncodingResult { /** Primary script output */ script: Buffer; /** All transaction outputs */ outputs: TransactionOutput[]; /** Estimated transaction size in bytes */ estimatedSize: number; /** Size of encoded data in bytes */ dataSize: number; } /** * Transaction output structure */ interface TransactionOutput { /** Output script */ script: Buffer; /** Output value in satoshis */ value: number; } /** * Base data encoder interface */ interface IDataEncoder<TData = any, TOptions = EncodingOptions> { /** * Encode data into transaction outputs */ encode(data: TData, options?: TOptions): EncodingResult; /** * Decode data from transaction outputs */ decode(outputs: TransactionOutput[]): TData; /** * Validate if data can be encoded */ validate(data: TData): boolean; /** * Get maximum data size supported */ getMaxDataSize(): number; /** * Get encoder type/protocol name */ getType(): string; } /** * Base encoding options */ interface EncodingOptions { /** Bitcoin network to use */ network?: Network; /** Enable compression */ compress?: boolean; /** Chunk size for data splitting */ chunkSize?: number; } /** * Internal Optimization Type Definitions * * Types for script optimization and pattern analysis * These are internal implementation details */ /** * Optimized script result */ interface OptimizedScript { /** Original script */ originalScript: Buffer; /** Optimized script */ optimizedScript: Buffer; /** Size reduction in bytes */ sizeReduction: number; /** Optimization techniques applied */ techniquesApplied: string[]; /** Whether optimization was successful */ success: boolean; /** Optimization duration in ms */ duration?: number; } /** * Pattern analysis result */ interface PatternAnalysis { /** Patterns found in the data */ patterns: DataPattern[]; /** Compression ratio achievable */ compressionRatio: number; /** Recommended optimization strategy */ recommendedStrategy: OptimizationStrategy; /** Entropy score */ entropy: number; /** Repetition score */ repetitionScore: number; } /** * Data pattern found during analysis */ interface DataPattern { /** Pattern type */ type: 'repetition' | 'sequence' | 'constant' | 'custom'; /** Start offset in data */ offset: number; /** Pattern length */ length: number; /** Number of occurrences */ occurrences: number; /** Pattern data */ data?: Buffer; /** Pattern description */ description?: string; } /** * Optimization strategy */ interface OptimizationStrategy { /** Strategy name */ name: string; /** Strategy description */ description: string; /** Expected size reduction percentage */ expectedReduction: number; /** Complexity level (1-10) */ complexity: number; /** Whether this strategy is recommended */ recommended: boolean; /** Alternative strategies */ alternatives?: string[]; } /** * Bitcoin Stamps Type Definitions * * Complete type system for Bitcoin Stamps protocol implementation */ /** * Bitcoin Stamps specific data structure */ interface BitcoinStampData { /** Raw image binary data */ imageData: Buffer; /** Optional stamp title */ title?: string; /** Optional description */ description?: string; /** Optional creator identifier */ creator?: string; /** Optional filename */ filename?: string; } /** * Bitcoin Stamps encoding options */ interface BitcoinStampEncodingOptions extends EncodingOptions { /** Enable data compression (default: true) */ enableCompression?: boolean; /** Custom dust value for P2WSH outputs (default: 330 for stamps) */ dustValue?: number; /** Maximum number of P2WSH outputs allowed (default: 50) */ maxOutputs?: number; /** Skip image validation (default: false) */ skipValidation?: boolean; /** UTXOs to use for creating the OP_RETURN (required for proper Counterparty encoding) */ utxos?: Array<{ txid: string; vout: number; value: number; }>; /** * CPID (Counterparty ID) for the stamp * Supports regular assets (A12345...) and sub-assets (A12345.SUBASSET) */ cpid?: string; /** Supply amount (default: 1) */ supply?: number; /** Whether the asset is locked (default: true) */ isLocked?: boolean; /** Enable script optimization (default: true) */ enableOptimization?: boolean; /** Enable pattern analysis for better optimization (default: true) */ enablePatternAnalysis?: boolean; } /** * Bitcoin Stamps encoding result */ type BitcoinStampEncodingResult = EncodingResult & { /** P2WSH outputs containing raw binary data */ p2wshOutputs: TransactionOutput[]; /** OP_RETURN output with Counterparty protocol data */ opReturnOutput: TransactionOutput; /** Stamp metadata */ metadata: StampMetadata; /** Whether compression was used */ compressionUsed: boolean; /** Pattern analysis results (if enabled) */ patternAnalysis?: PatternAnalysis; /** Script optimization results (if enabled) */ scriptOptimization?: OptimizedScript; }; /** * Stamp metadata information */ interface StampMetadata { /** Image format (PNG, GIF, JPEG, WEBP) */ imageFormat: string; /** Image dimensions */ imageDimensions: { width: number; height: number; }; /** Original size in bytes */ originalSize: number; /** Compressed size in bytes (if compression used) */ compressedSize?: number; /** Base64 data URI for the image */ base64URI: string; } /** * P2WSH Encoder Type Definitions * * Types for Pay-to-Witness-Script-Hash encoding */ /** * P2WSH-specific encoding options */ interface P2WSHEncodingOptions extends EncodingOptions { /** Dust value for outputs in satoshis */ dustValue?: number; /** Maximum number of outputs allowed */ maxOutputs?: number; } /** * P2WSH data structure */ interface P2WSHData { /** Raw binary data to embed */ data: Buffer; /** Optional content type identifier */ contentType?: string; /** Protocol identifier (e.g., 'SRC20', 'STAMP') */ protocol?: string; } /** * P2WSH encoding result */ type P2WSHEncodingResult = EncodingResult & { /** Witness script for redemption */ witnessScript: Buffer; /** Script hash */ scriptHash: Buffer; /** Redeem script (alias for witnessScript) */ redeemScript: Buffer; /** Whether signature is required */ requiresSignature?: boolean; /** Timelock value if applicable */ timelock?: number; /** Whether this is a multisig script */ isMultisig?: boolean; /** Number of required signatures for multisig */ requiredSignatures?: number; }; /** * Counterparty Protocol Encoder * * Implements proper Counterparty protocol encoding for Bitcoin Stamps * Based on JPJA's implementation from Electrum-Counterparty * * References: * - https://github.com/Jpja/Electrum-Counterparty/blob/ad237f654fd7ec2821341a753aa698898664a5a8/olga_stamp.html * - https://github.com/Jpja/Electrum-Counterparty/blob/ad237f654fd7ec2821341a753aa698898664a5a8/cip33_issuance.html * - https://counterparty.io/docs/protocol_specification/ */ /** * Counterparty Protocol Constants */ declare const COUNTERPARTY_CONSTANTS: { PREFIX: string; PREFIX_HEX: string; MSG_SEND: number; MSG_ORDER: number; MSG_BTCPAY: number; MSG_ISSUANCE: number; MSG_ISSUANCE_EXTENDED: number; MSG_ISSUANCE_WITH_DESCRIPTION: number; MSG_BROADCAST: number; MSG_BET: number; MSG_DIVIDEND: number; MSG_BURN: number; MSG_CANCEL: number; SUBASSET_DIGITS: string; B26_DIGITS: string; MAX_ASSET_NAME_LENGTH: number; MIN_NUMERIC_ASSET_ID: number; MAX_NUMERIC_ASSET_ID: bigint; STAMP_PREFIX: string; DEFAULT_DIVISIBILITY: number; DEFAULT_LOCKED: boolean; }; /** * RC4 Encryption Implementation * Pure JavaScript implementation since crypto.createCipheriv('rc4') is deprecated */ declare class RC4 { /** * RC4 algorithm implementation */ static rc4(key: Buffer, data: Buffer): Buffer; /** * RC4 encrypt/decrypt (symmetric) */ static encrypt(key: Buffer, data: Buffer): Buffer; /** * RC4 encrypt hex string using hex key */ static encryptHex(keyHex: string, dataHex: string): string; /** * Convert hex string to binary string (matches JavaScript reference) */ private static hex2bin; /** * Convert binary string to hex (matches JavaScript reference) */ private static bin2hex; /** * RC4 algorithm using binary strings (matches JavaScript reference exactly) */ private static rc4Binary; } /** * Main Counterparty Encoder class * Provides methods for encoding Counterparty protocol messages */ declare class CounterpartyEncoder { /** * Encode issuance using modern interface matching Counterparty API exactly */ encodeIssuance(params: { assetId: bigint; quantity: number; divisible: boolean; lock: boolean; description: string; reset?: boolean; }): { data: Buffer; } | null; } /** * Asset Name Encoder * Handles conversion between asset names and numeric IDs */ declare class AssetNameEncoder { /** * Convert asset name to numeric ID */ static nameToId(assetName: string): bigint; /** * Encode asset ID as 8 bytes (big-endian) */ static encodeAssetId(assetName: string): Buffer; } /** * Counterparty Message Encoder */ declare class CounterpartyMessageEncoder { /** * Encrypt message data (can be mocked for testing) */ private encryptData; /** * Encode data into Counterparty OP_RETURN format */ encode(data: any): Promise<{ script: Buffer; value: number; isEncrypted: boolean; protocolVersion?: string; messageType?: string; compressionUsed?: boolean; originalSize?: number; compressedSize?: number; } | null>; /** * Create issuance message (type 20) - Post-2023 format * Following the current Counterparty protocol format (no callable/call fields) */ static encodeIssuance(assetName: string, quantity: number, divisible?: boolean, locked?: boolean, reset?: boolean): Buffer; /** * Create enhanced issuance message (type 20 with description) - Post-2023 format * Issuance with description (used for STAMP:filename) */ static encodeIssuanceWithDescription(assetName: string, quantity: number, description: string, divisible?: boolean, locked?: boolean, reset?: boolean): Buffer; /** * Create full Counterparty message with prefix */ static createMessage(payload: Buffer): Buffer; /** * Encrypt message using RC4 with transaction ID as key */ static encryptMessage(message: Buffer, txid: string): Buffer; } /** * P2WSH Message Issuance * Port of P2WSH_msg_issuance from JPJA's implementation */ declare function P2WSHMsgIssuance(assetName: string, supply: number, description: string, flags?: string, // Default: divisible=false, reset=false, locked=true assetType?: string): string; /** * RC4 Hex Encryption * Port of rc4_hex from JPJA's implementation */ declare function rc4Hex(key: string, plaintext: string): string; /** * Decode Transaction * Port of decode_tx for validation */ declare function decodeTx(opreturn: string, txid: string): any; /** * Main Counterparty Issuance Builder * Following JPJA's prepareOpReturn flow */ declare class CounterpartyIssuanceBuilder { /** * Prepare OP_RETURN for stamp issuance * Based on JPJA's prepareOpReturn function */ static prepareOpReturn(selectedUtxos: Array<{ txid: string; vout: number; value: number; }>, assetName: string, supply: number, filename?: string, isLocked?: boolean, assetType?: string, numberOfMints?: number): Array<{ opreturn: string; opreturnUnencoded: string; }>; /** * Create OP_RETURN output script for Bitcoin transaction */ static createOpReturnOutput(opreturnHex: string): Buffer; /** * Build complete stamp issuance with OP_RETURN */ static buildStampIssuance(utxos: Array<{ txid: string; vout: number; value: number; }>, assetName: string, supply?: number, filename?: string, options?: { isLocked?: boolean; assetType?: string; numberOfMints?: number; }): { opReturnScript: Buffer; opReturnHex: string; unencryptedHex: string; metadata: { assetName: string; supply: number; description: string; locked: boolean; messageType: number; }; }; } /** * SRC-20 Token Encoder/Decoder * * Production-compatible implementation matching BTCStampsExplorer exactly * Uses direct data embedding in P2WSH script hashes * * Reference: BTCStampsExplorer/utils/decodeSrc20OlgaTx.ts */ /** * SRC-20 Encoder Implementation * Matches BTCStampsExplorer production exactly */ declare class SRC20Encoder { constructor(_network?: bitcoin.Network); /** * Encode SRC-20 data using direct P2WSH data embedding * Data is embedded directly in the script hash, NOT in witness scripts * Supports both sync and async usage for backward compatibility */ encode(data: SRC20Data | SRC20Operation, options?: SRC20EncodingOptions): SRC20EncodingResult; /** * Async version of encode for compatibility */ encodeAsync(data: SRC20Data | SRC20Operation, options?: SRC20EncodingOptions): Promise<SRC20EncodingResult>; /** * Encode SRC-20 data using direct P2WSH data embedding (sync version) * Data is embedded directly in the script hash, NOT in witness scripts * * NEW: Creates complete transaction outputs including dust outputs in stampchain order */ encodeSync(data: SRC20Data, options?: SRC20EncodingOptions): SRC20EncodingResult; /** * Normalize SRC20Operation to SRC20Data type */ private normalizeSRC20Operation; /** * Async encode with automatic compression decision */ encodeWithCompression(data: SRC20Data, options?: SRC20EncodingOptions): SRC20EncodingResult; /** * Decode SRC-20 data from P2WSH outputs */ decodeFromOutputs(p2wshOutputs: Array<{ script: Buffer; value: number; }>): Promise<SRC20Data | null>; /** * Decode SRC-20 data from transaction * Matches BTCStampsExplorer/utils/decodeSrc20OlgaTx.ts */ decode(tx: bitcoin.Transaction): Promise<SRC20Data | null>; /** * Validate SRC-20 data */ validate(data: any): boolean; /** * Get validation errors */ getValidationErrors(data: SRC20Data): string[]; /** * Create complete transaction outputs in stampchain order * This is the key method that makes SRC-20 encoding as simple as Bitcoin Stamps */ private createCompleteOutputs; /** * Create P2WSH outputs with direct data embedding * Data is embedded directly in the 32-byte "hash", NOT in witness scripts * Production format: Single P2WSH output with length-prefixed data */ private createP2WSHOutputs; /** * Normalize data to production format * lowercase protocol and operation to match real transactions, uppercase tick, numbers not strings for amounts */ private normalizeData; /** * Denormalize data back to standard format */ private denormalizeData; /** * Parse amount to number format to match real transactions * For TRANSFER operations with multiple amounts, returns comma-separated string */ private parseAmount; /** * Parse numeric value handling large numbers up to uint64 max * JavaScript can represent integers up to 2^53-1 exactly, but we need to handle up to 2^64-1 * For numbers beyond safe integer range, they'll be represented as floats in JSON */ private parseNumericValue; /** * Create OP_RETURN output for SRC-20 operation * Uses Counterparty protocol for Bitcoin Stamps compatibility */ private createOpReturnOutput; /** * Estimate transaction size */ private estimateTransactionSize; /** * Zlib decompression helper */ private zlibDecompress; } /** * Utility class for working with P2WSH addresses and SRC-20 encoding */ declare class P2WSHAddressUtils { /** * Convert hex data to P2WSH addresses * Creates P2WSH outputs with data embedded in script hashes */ static hexToAddresses(hexData: string, network?: bitcoin.Network): string[]; /** * Extract hex data from P2WSH outputs * In SRC-20 encoding, data is embedded directly in the script (not a hash) */ static outputsToHex(outputs: Array<{ script: Buffer; value: number; }>): string | null; } /** * Helper functions for SRC-20 operations - now with complete transaction encoding! * Simple one-step encoding like BitcoinStampsEncoder */ declare class SRC20Helper { /** * Create complete DEPLOY transaction outputs (NEW: simplified approach) */ static encodeDeploy(tick: string, max: string, lim: string, fromAddress: string, options?: Partial<Omit<SRC20DeployData, 'p' | 'op' | 'tick' | 'max' | 'lim'>> & Partial<SRC20EncodingOptions>): Promise<SRC20EncodingResult>; /** * Create complete MINT transaction outputs (NEW: simplified approach) */ static encodeMint(tick: string, amt: string, fromAddress: string, options?: Partial<SRC20EncodingOptions>): Promise<SRC20EncodingResult>; /** * Create complete TRANSFER transaction outputs (NEW: simplified approach) */ static encodeTransfer(tick: string, amt: string, fromAddress: string, toAddress: string, options?: Partial<SRC20EncodingOptions>): Promise<SRC20EncodingResult>; /** * Legacy: Create DEPLOY operation data only (use encodeDeploy instead) * @deprecated Use encodeDeploy for complete transaction outputs */ static createDeploy(tick: string, max: string, lim: string, options?: Partial<Omit<SRC20DeployData, 'p' | 'op' | 'tick' | 'max' | 'lim'>>): SRC20DeployData; /** * Legacy: Create MINT operation data only (use encodeMint instead) * @deprecated Use encodeMint for complete transaction outputs */ static createMint(tick: string, amt: string): SRC20MintData; /** * Legacy: Create TRANSFER operation data only (use encodeTransfer instead) * @deprecated Use encodeTransfer for complete transaction outputs */ static createTransfer(tick: string, amt: string): SRC20TransferData; } declare const SRC20Operations: { deploy: typeof SRC20Helper.createDeploy; mint: typeof SRC20Helper.createMint; transfer: typeof SRC20Helper.createTransfer; }; /** * Bitcoin Stamps Encoder * * Complete implementation of Bitcoin Stamps protocol using: * - P2WSH encoding for raw binary data embedding * - Counterparty OP_RETURN with STAMP:filename reference * - Bitcoin transaction size limit (100KB max) * - Multi-format support (PNG, GIF, JPEG, WEBP) * - Comprehensive metadata handling * * Note: No pixel dimension constraints - only transaction size matters */ /** * Counterparty Protocol Handler for Bitcoin Stamps * * Uses proper Counterparty issuance format with RC4 encryption * Based on counterparty-core/counterpartycore/lib/messages/issuance.py */ declare class CounterpartyProtocolHandler { /** * Create Counterparty OP_RETURN for stamps using proper issuance encoding with RC4 * Following the exact counterparty-core implementation */ static createOpReturnOutput(utxos: Array<{ txid: string; vout: number; value: number; }>, cpid: string, supply?: number): TransactionOutput; /** * RC4 encryption/decryption (same function for both) * Based on the exact algorithm used by counterparty-core */ private static rc4Encrypt; /** * Decrypt Counterparty OP_RETURN message */ static decryptOpReturn(encryptedData: Buffer, inputTxid: string): Buffer | null; /** * Extract stamp information from encrypted Counterparty OP_RETURN * NOTE: Requires input TXID to decrypt properly */ static extractStampInfo(opReturnScript: Buffer, inputTxid?: string): { stampId: string; filename?: string; } | null; } /** * Bitcoin Stamps Metadata Handler */ declare class StampMetadataHandler { /** * Create stamp metadata object */ static createMetadata(imageData: Buffer, compressedSize?: number, skipValidation?: boolean): StampMetadata; /** * Validate stamp metadata constraints */ static validateMetadata(metadata: StampMetadata): string[]; } /** * Encoder for creating Bitcoin Stamps protocol-compliant transactions * * @remarks * BitcoinStampsEncoder handles the encoding of data for Bitcoin Stamps, which store * data directly on-chain using multi-signature outputs. This makes the data * pruning-resistant and permanently stored on the Bitcoin blockchain. * * Features: * - Automatic data compression (gzip, brotli) * - Base64 encoding for binary data * - Protocol prefix handling ('stamp:' prefix) * - Multi-signature script generation * - P2WSH output creation * - Chunk size optimization for efficiency * * @example * ```typescript * const encoder = new BitcoinStampsEncoder(); * const result = await encoder.encode({ * data: imageBuffer, * encoding: 'gzip', * pubkeys: [pubkey1, pubkey2, pubkey3] * }); * * // result.outputs contains the P2WSH outputs for the transaction * ``` */ declare class BitcoinStampsEncoder { private p2wshEncoder; private readonly defaultOptions; constructor(network?: bitcoin.Network, options?: Partial<BitcoinStampEncodingOptions>); /** * Create fake P2WSH outputs for stamp data (stampchain.io format) * * CRITICAL: This is NOT standard P2WSH! * Stampchain.io puts raw image data in the "script hash" field * Format: OP_0 <32-byte-image-chunk> * * IMPORTANT: Stampchain.io adds a leading 0x00 byte before the image data! */ private createStampDataOutputs; /** * Encode Bitcoin Stamp data using P2WSH + Counterparty OP_RETURN (async version) */ encode(data: BitcoinStampData, options?: BitcoinStampEncodingOptions): Promise<BitcoinStampEncodingResult>; /** * Encode Bitcoin Stamp data using P2WSH + Counterparty OP_RETURN (sync version) */ encodeSync(data: BitcoinStampData, options?: BitcoinStampEncodingOptions): BitcoinStampEncodingResult; /** * Decode Bitcoin Stamp data from transaction outputs */ decode(outputs: TransactionOutput[]): BitcoinStampData; /** * Validate Bitcoin Stamp data */ validate(data: BitcoinStampData): boolean; /** * Get maximum data size that can be encoded */ getMaxDataSize(): number; /** * Get encoder type */ getType(): string; /** * Create a Bitcoin Stamp from base64 image data */ static fromBase64(base64Data: string, options?: { title?: string; description?: string; creator?: string; filename?: string; }): BitcoinStampData; /** * Create a Bitcoin Stamp from file buffer */ static fromBuffer(imageBuffer: Buffer, options?: { title?: string; description?: string; creator?: string; filename?: string; }): BitcoinStampData; /** * Extract stamp data from transaction outputs (new format with filename in OP_RETURN) */ static extractStampFromTransaction(outputs: TransactionOutput[]): BitcoinStampData | null; } /** * P2WSH Data Encoder * * Implements P2WSH-based data embedding for Bitcoin data storage. * Supports both SRC-20 tokens and Bitcoin Stamps data embedding using direct binary data handling. * * Key Features: * - Direct binary data handling without base64 encoding for blockchain storage * - P2WSH (Pay-to-Witness-Script-Hash) script construction following BIP-141 * - Intelligent data chunking for large binary payloads * - Script size validation (10,000 byte script limit, 520 byte push data limit) * - Witness script template: OP_FALSE OP_IF <raw_binary_chunk> OP_ENDIF */ interface P2WSHChunkResult { chunks: Buffer[]; totalSize: number; chunkCount: number; } /** * Binary Data Utilities for P2WSH encoding */ declare class BinaryDataUtils { static readonly MAX_SCRIPT_SIZE = 10000; static readonly MAX_PUSH_DATA_SIZE = 520; static readonly WITNESS_SCRIPT_OVERHEAD = 6; static readonly MAX_CHUNK_SIZE = 519; static readonly DEFAULT_DUST_VALUE = 546; /** * Validate if binary data can be encoded within Bitcoin's limits */ static validateBinaryData(data: Buffer): void; /** * Chunk binary data into sizes suitable for Bitcoin script embedding */ static chunkBinaryData(data: Buffer, chunkSize?: number): P2WSHChunkResult; /** * Reconstruct original data from chunks */ static reconstructFromChunks(chunks: Buffer[]): Buffer; /** * Calculate the total transaction size for given data */ static estimateTransactionSize(dataSize: number, outputCount: number): number; /** * Validate chunk integrity */ static validateChunks(originalData: Buffer, chunks: Buffer[]): boolean; } /** * P2WSH Script Constructor for Data Embedding */ declare class P2WSHScriptConstructor { private network; constructor(network?: bitcoin.Network); /** * Create a witness script for embedding binary data * Pattern: OP_FALSE OP_IF <data_chunk> OP_ENDIF */ createWitnessScript(dataChunk: Buffer): Buffer; /** * Create P2WSH output script from witness script */ createP2WSHOutput(witnessScript: Buffer, value?: number): TransactionOutput; /** * Extract data from witness script */ extractDataFromWitnessScript(witnessScript: Buffer): Buffer; /** * Validate P2WSH output script */ validateP2WSHOutput(outputScript: Buffer): boolean; } /** * Main P2WSH Data Encoder implementation */ declare class P2WSHEncoder implements IDataEncoder<P2WSHData, P2WSHEncodingOptions> { private scriptConstructor; private readonly defaultDustValue; constructor(network?: bitcoin.Network, dustValue?: number); /** * Encode binary data using P2WSH standard */ encode(data: P2WSHData, options?: P2WSHEncodingOptions, customTemplate?: any): P2WSHEncodingResult; /** * Decode binary data from P2WSH outputs */ decode(outputs: TransactionOutput[]): P2WSHData; /** * Decode from witness scripts (when available) */ decodeFromWitnessScripts(witnessScripts: Buffer[]): P2WSHData; /** * Validate P2WSH data */ validate(data: P2WSHData): boolean; /** * Get maximum data size that can be encoded */ getMaxDataSize(): number; /** * Get encoder type */ getType(): string; } export { AssetNameEncoder, BinaryDataUtils, type BitcoinStampData, type BitcoinStampEncodingOptions, type BitcoinStampEncodingResult, BitcoinStampsEncoder, COUNTERPARTY_CONSTANTS, CounterpartyEncoder, CounterpartyIssuanceBuilder, CounterpartyMessageEncoder, CounterpartyProtocolHandler, P2WSHAddressUtils, type P2WSHChunkResult, type P2WSHData, P2WSHEncoder, type P2WSHEncodingOptions, type P2WSHEncodingResult, P2WSHMsgIssuance, P2WSHScriptConstructor, P2WSHMsgIssuance as P2WSH_msg_issuance, RC4, SRC20Data, SRC20DeployData, SRC20Encoder, SRC20EncodingOptions, SRC20EncodingResult, SRC20Helper, SRC20MintData, SRC20Operation, SRC20Operations, SRC20TransferData, StampMetadataHandler, decodeTx, decodeTx as decode_tx, rc4Hex, rc4Hex as rc4_hex };