import { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm'; /** * Parameters for building the PegIn input PSBT */ export interface BuildPeginInputPsbtParams { /** * Vault core (tx-graph) version the Pre-PegIn was built with. Must match * the version passed to buildPrePeginPsbt() so the HTLC connector scripts * are derived for the same graph. */ vaultCoreVersion: number; /** * PegIn transaction hex (1 input spending Pre-PegIn HTLC output 0). * Returned by buildPeginTxFromFundedPrePegin(). */ peginTxHex: string; /** * Funded Pre-PegIn transaction hex. * Used to look up the HTLC output that the PegIn input spends. */ fundedPrePeginTxHex: string; /** Depositor's BTC public key (x-only, 64-char hex) */ depositorPubkey: string; /** Vault provider's BTC public key (x-only, 64-char hex) */ vaultProviderPubkey: string; /** Vault keeper BTC public keys (x-only, 64-char hex) */ vaultKeeperPubkeys: string[]; /** Universal challenger BTC public keys (x-only, 64-char hex) */ universalChallengerPubkeys: string[]; /** SHA256 hash commitment (64 hex chars = 32 bytes) */ hashlock: string; /** CSV timelock in blocks for the HTLC refund path */ timelockRefund: number; /** Bitcoin network */ network: Network; } /** * Result of building the PegIn input PSBT */ export interface BuildPeginInputPsbtResult { /** PSBT hex for the depositor to sign */ psbtHex: string; } /** * Build PSBT for depositor to sign the PegIn transaction's HTLC leaf 0 input. * * The PegIn transaction spends the Pre-PegIn HTLC output (output 0) via the * hashlock + all-party script (leaf 0). The depositor provides one of the required * signatures; the vault provider and keepers provide theirs separately via the * signPeginInput RPC. * * The PSBT uses Taproot script-path spending: * - witnessUtxo: the Pre-PegIn HTLC output * - tapLeafScript: hashlock leaf script + control block * - tapInternalKey: NUMS unspendable key (BIP-341 nothing-up-my-sleeve) * * @param params - PegIn input PSBT parameters * @returns PSBT hex ready for depositor signing * @throws If PegIn tx does not have exactly 1 input * @throws If PegIn input does not reference the Pre-PegIn HTLC output * @throws If Pre-PegIn tx output 0 is not found */ export declare function buildPeginInputPsbt(params: BuildPeginInputPsbtParams): Promise; /** * Extract the depositor's Schnorr signature from a signed PegIn input PSBT. * * Supports non-finalized PSBTs with tapScriptSig entries. Finalized PSBTs are * rejected because the witness stack does not reliably identify the depositor * signature by public key. * * PegIn input signatures must use implicit Taproot SIGHASH_DEFAULT, which is * encoded by omitting the sighash byte. Signatures with an appended sighash byte * are rejected rather than stripped. * * @param signedPsbtHex - Signed PSBT hex * @param depositorPubkey - Depositor's x-only public key (64-char hex) * @returns 64-byte Schnorr signature (128 hex chars, no sighash flag) * @throws If no signature is found for the depositor's key */ export declare function extractPeginInputSignature(signedPsbtHex: string, depositorPubkey: string): string; /** * Finalize a signed PegIn input PSBT and return the depositor-signed transaction hex. * * The default tapscript finalizer builds the full witness stack [sig, script, controlBlock] * that vaultd requires when verifying the depositor signature on-chain. * * @param signedPsbtHex - Non-finalized signed PSBT hex (returned by wallet with autoFinalized: false) * @returns Depositor-signed PegIn transaction hex with full taproot witness stack */ export declare function finalizePeginInputPsbt(signedPsbtHex: string): string; /** * Extract and validate a 64-byte Schnorr signature. * PegIn input signatures must use implicit Taproot SIGHASH_DEFAULT, which is * encoded by omitting the sighash byte. Reject 65-byte signatures instead of * stripping the sighash byte because it changes the signed Taproot message. * @internal */ export declare function extractSchnorrSig(sig: Uint8Array): string; //# sourceMappingURL=peginInput.d.ts.map