import { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm'; import { BitcoinWallet } from '../../../../shared/wallets/interfaces'; import { DepositTerms } from '../../deposit-terms'; import { PeginStatusReader, PresignClient } from './interfaces'; /** * Context required for signing payout transactions. * Caller builds this from on-chain data (contract queries, GraphQL, config). */ export interface PayoutSigningContext { /** * Vault core (tx-graph) version the vault was registered under — the * vault's stamped on-chain `vaultCoreVersion` from `BTCVaultRegistry`. * Selects which graph's connector scripts every payout/nopayout PSBT is * rebuilt with. */ vaultCoreVersion: number; /** Raw pegin BTC transaction hex (for PSBT construction) */ peginTxHex: string; /** Vault provider's BTC public key (x-only hex, no prefix) */ vaultProviderBtcPubkey: string; /** Sorted vault keeper BTC public keys (x-only hex, no prefix) */ vaultKeeperBtcPubkeys: string[]; /** Sorted universal challenger BTC public keys (x-only hex, no prefix) */ universalChallengerBtcPubkeys: string[]; /** Depositor's BTC public key (x-only hex, no prefix) */ depositorBtcPubkey: string; /** Pegin timelock from the locked offchain params version */ timelockPegin: number; /** * Assert CSV timelock from the locked offchain params version (blocks). * Source: ProtocolParams contract via * `ViemProtocolParamsReader.getOffchainParamsByVersion(...).timelockAssert`. * Required for the depositor-graph NoPayout local rebuild. */ timelockAssert: number; /** * Security council member x-only public keys (hex, no prefix). * Source: ProtocolParams contract via * `getOffchainParamsByVersion(...).securityCouncilKeys`. * Required to rebuild every Assert:0 leaf (payout and NoPayout) locally. */ councilMembers: string[]; /** * M-of-N council quorum threshold. * Source: ProtocolParams contract via * `getOffchainParamsByVersion(...).councilQuorum`. * Required to rebuild every Assert:0 leaf (payout and NoPayout) locally. */ councilQuorum: number; /** BTC network (Mainnet, Testnet, etc.) */ network: Network; /** On-chain registered depositor payout scriptPubKey (hex) */ registeredPayoutScriptPubKey: string; /** VP commission (bps) from `BTCVaultRegistry`; caps the VP-claimer payout commission output. */ commissionBps: number; /** * Tx-graph fee rate (sat/vB) from the locked offchain params version — * `getOffchainParamsByVersion(...).feeRate`, the rate the VP built the * graph with. Bounds every payout's implicit fee (payout fee band). */ protocolFeeRate: bigint; /** * RFC-006 resolved keeper payout destinations at the vault's frozen * `appKeeperKeyEpoch`, keyed by lowercased x-only operation pubkey. */ vkClaimerPayoutScriptPubKeys: Readonly>; /** * RFC-006 resolved VP commission destination at the vault's frozen * `vpKeyEpoch`. */ vpCommissionScriptPubKey: string; } export interface RunDepositorPresignFlowParams { /** VP client implementing the status reader interface */ statusReader: PeginStatusReader; /** VP client implementing the presign transaction flow interface */ presignClient: PresignClient; /** Bitcoin wallet for signing */ btcWallet: BitcoinWallet; /** BTC pegin transaction ID (unprefixed hex, 64 chars) */ peginTxid: string; /** Depositor's x-only BTC public key (unprefixed hex, 64 chars) */ depositorPk: string; /** Signing context built from on-chain data */ signingContext: PayoutSigningContext; /** * Required for approval-capable wallets. Fresh flows pass * PreparePeginResult.depositTerms; resume flows rebuild them from * on-chain state (the vault app's rebuildDepositTerms). */ depositTerms?: DepositTerms; /** Maximum polling timeout in milliseconds (default: 20 min) */ timeoutMs?: number; /** AbortSignal for cancellation */ signal?: AbortSignal; /** Optional progress callback (completed claimers, total claimers) */ onProgress?: (completed: number, total: number) => void; } /** * Poll for payout transactions, sign them, sign the depositor graph, * and submit all signatures to the vault provider. * * This is the main deposit protocol step between registration and activation. * * @throws Error on timeout, abort, signing failure, or RPC error */ export declare function runDepositorPresignFlow(params: RunDepositorPresignFlowParams): Promise; //# sourceMappingURL=runDepositorPresignFlow.d.ts.map