/** * Pure validation functions for deposit operations. * * All validations return a consistent {@link ValidationResult} format or throw * on critical failures (e.g. missing protocol participants). * * Business rules (single-provider limit, max vault count) and form-flow * checks (wallet connected) belong in the consumer layer. * * @module tbv/core/services/deposit/validation */ export interface ValidationResult { valid: boolean; error?: string; warnings?: string[]; } /** * Parameters for checking if a deposit form is valid. */ export interface DepositFormValidityParams { /** Deposit amount in satoshis */ amountSats: bigint; /** Minimum deposit from protocol params */ minDeposit: bigint; /** Maximum deposit from protocol params (optional) */ maxDeposit?: bigint; /** User's available BTC balance in satoshis */ btcBalance: bigint; /** Estimated transaction fee in satoshis */ estimatedFeeSats?: bigint; /** Depositor claim value in satoshis (required output for challenge transactions) */ depositorClaimValue?: bigint; } export interface RemainingCapacityParams { /** Requested deposit amount in satoshis */ amount: bigint; /** * Effective remaining capacity in satoshis (min of protocol-total and * per-address remaining). `null` means no cap applies. */ effectiveRemaining: bigint | null; } /** Narrow structural type for UTXO — avoids importing vault-specific types. */ interface UtxoLike { txid: string; vout: number; value: number; } /** * Parameters for validating multi-vault deposit flow inputs. * * Callers must resolve any async loading states before calling — the SDK * validates resolved data, not React hook state. * * Form-flow checks (wallet connected, provider selected) are the caller's * responsibility and are NOT performed here. */ export interface MultiVaultDepositFlowInputs { vaultAmounts: bigint[]; confirmedUTXOs: UtxoLike[]; vaultProviderBtcPubkey: string; vaultKeeperBtcPubkeys: string[]; universalChallengerBtcPubkeys: string[]; /** Protocol minimum deposit per vault (satoshis) */ minDeposit: bigint; /** Protocol maximum deposit per vault (satoshis) */ maxDeposit?: bigint; } /** * Check if deposit amount is within valid range and affordable. * * Returns false when fees/claim value are not yet known (still loading), * and includes them in the balance check once available. */ export declare function isDepositAmountValid(params: DepositFormValidityParams): boolean; /** * Validate deposit amount against minimum and maximum constraints. */ export declare function validateDepositAmount(amount: bigint, minDeposit: bigint, maxDeposit?: bigint): ValidationResult; /** * Validate that the requested deposit fits within the effective remaining cap. */ export declare function validateRemainingCapacity(params: RemainingCapacityParams): ValidationResult; /** * Validate that selected providers exist in the available set. * * Business rules (e.g. single-provider limit) are the caller's responsibility. */ export declare function validateProviderSelection(selectedProviders: string[], availableProviders: string[]): ValidationResult; /** * Validate vault amounts array for multi-vault deposits. * Checks count, positivity, and per-vault min/max protocol limits. * * Max vault count limits are the caller's responsibility. */ export declare function validateVaultAmounts(amounts: bigint[], minDeposit?: bigint, maxDeposit?: bigint): ValidationResult; /** * Validate vault provider BTC public key format. */ export declare function validateVaultProviderPubkey(pubkey: string): ValidationResult; /** * Validate protocol-level multi-vault deposit inputs. * Throws an error if any validation fails. * * Form-flow checks (wallet connections, provider selection) must be * performed by the caller before invoking this function. */ export declare function validateMultiVaultDepositInputs(params: MultiVaultDepositFlowInputs): void; export {}; //# sourceMappingURL=validation.d.ts.map