import * as bitcoin from "bitcoinjs-lib"; import type { BtcUtxo } from "../types/bitcoin.types"; export declare const LEAF_VERSION_TAPSCRIPT: number; import type { PreparedUtxo } from "../src/chains/bitcoin/inscription/makeCommitPsbt"; /** * Encodes a number as a Bitcoin compact size. * Bitcoin uses a custom variable-length integer format for script element counts and lengths. * * @param n - The number to encode * @returns A Buffer containing the compact size representation */ export declare const compactSize: (n: number) => Buffer; /** * Builds a witness stack for the reveal transaction. * The witness contains the data needed to reveal the inscribed data and spend the Taproot output. * * @param leafScript - The script containing the cross-chain message * @param controlBlock - The Taproot control block needed to validate the script path * @returns A Buffer containing the encoded witness data */ export declare const buildRevealWitness: (leafScript: Buffer, controlBlock: Buffer) => Buffer; /** * Creates a commit transaction that embeds cross-chain message data in a Taproot output. * The commit transaction creates a special UTXO that can be spent later to reveal the inscription. * * @param key - Bitcoin signer (private key) * @param utxos - Available UTXOs to spend * @param changeAddress - Address to send change to * @param inscriptionData - Cross-chain message data to inscribe * @param api - Bitcoin API endpoint for fetching transaction data * @param amountSat - Amount to inscribe in satoshis * @param feeSat - Fee for the transaction in satoshis * @returns Object containing transaction data and Taproot script details */ export declare const makeCommitTransaction: (key: bitcoin.Signer, utxos: BtcUtxo[], changeAddress: string, inscriptionData: Buffer, api: string, amount: number, network: bitcoin.Network, feeSat?: number) => Promise<{ controlBlock: Buffer; internalKey: Buffer; leafScript: Buffer; txHex: string; }>; /** * Converts BtcUtxo[] to PreparedUtxo[] by fetching transaction details for each UTXO * to get the scriptPubKey information needed for PSBT creation. */ export declare const prepareUtxos: (address: string, api: string) => Promise; export declare const calculateRevealFee: (commitData: { controlBlock: Buffer; internalKey: Buffer; leafScript: Buffer; }, feeRate: number) => { revealFee: number; vsize: number; }; /** * Creates a reveal transaction that spends the commit transaction output and reveals the inscription. * This transaction sends funds to the ZetaChain gateway while exposing the cross-chain message. * * @param commitTxId - Transaction ID of the commit transaction * @param commitVout - Output index in the commit transaction to spend (typically 0) * @param commitValue - Value of the commit output in satoshis * @param to - Gateway address to send funds to * @param feeRate - Fee rate in satoshis per vbyte * @param commitData - Data from the commit transaction needed to spend it * @param key - Bitcoin signer (private key) * @returns Hex-encoded transaction ready for broadcast */ export declare const makeRevealTransaction: (commitTxId: string, commitVout: number, commitValue: number, to: string, feeRate: number, commitData: { controlBlock: Buffer; internalKey: Buffer; leafScript: Buffer; }, key: bitcoin.Signer, network: bitcoin.Network) => string; /** * Safely converts a Bitcoin amount from string to number. * Validates that the amount doesn't exceed JavaScript's safe integer limit. * * @param amount - The Bitcoin amount as a string (e.g. "1.5" for 1.5 BTC) * @param decimals - Number of decimal places (default: 8 for Bitcoin) * @returns The amount in satoshis as a number * @throws Error if the amount exceeds JavaScript's safe integer limit */ export declare const safeParseBitcoinAmount: (amount: string, decimals?: number) => number;