import { Abi, Address, Hash, Hex } from 'viem'; /** * A single ETH contract-write call. The SDK assembles these; the caller * executes them via viem, wagmi, a wallet provider, or any other transport. */ export interface EthContractWriteCall { address: Address; abi: Abi; functionName: string; args: readonly unknown[]; } /** * Minimum shape the SDK requires from any contract-write result. Callers may * return richer objects (e.g. including the receipt) — the SDK propagates * them unchanged via the generic parameter on {@link EthContractWriter}. */ export interface EthContractWriteResult { transactionHash: Hash; } /** * Caller-provided contract writer. The generic `R` lets callers return any * transport-specific result shape (e.g. `{ transactionHash, receipt }`); * the SDK forwards that shape back through `activateVault`. */ export type EthContractWriter = (call: EthContractWriteCall) => Promise; export interface ActivateVaultInput { /** BTCVaultRegistry contract address (env-specific). */ btcVaultRegistryAddress: Address; /** Vault ID (bytes32, 0x-prefixed). */ vaultId: Hex; /** * HTLC secret preimage (bytes32). A missing `0x` prefix or an uppercase * `0X` prefix is normalised before validation. */ secret: string; /** * Optional hashlock for client-side pre-validation. When provided, the SDK * rejects before calling `writeContract` if `sha256(secret) != hashlock`. */ hashlock?: Hex; /** * Activation metadata passed through to the contract. Required to keep * the "empty metadata" convention explicit at the call site — pass `"0x"` * (empty bytes) when no metadata is needed. Must be a 0x-prefixed hex * string with an even number of hex chars. */ activationMetadata: Hex; /** Caller-provided write callback — see {@link EthContractWriter}. */ writeContract: EthContractWriter; /** * Optional abort signal. Checked before validation runs; since validation * is fully synchronous, cancellation between validation and the write is * not observable and callers should rely on the transport's own * cancellation support for that window. */ signal?: AbortSignal; } /** * Reveal the HTLC secret on Ethereum and activate the vault. * * Validates inputs, optionally pre-checks the secret against the expected * hashlock, and delegates the contract write to `writeContract`. Returns * whatever the writer returns so callers can keep richer transport-specific * metadata (e.g. viem receipts) end-to-end. * * @throws `Error` if `btcVaultRegistryAddress` is not a valid 20-byte address * @throws `Error` if `vaultId` or `secret` is not a valid 32-byte hex * @throws `Error` if `hashlock` is provided and is not a valid 32-byte hex, * or if `sha256(secret) != hashlock` * @throws `Error` if `activationMetadata` is not a 0x-prefixed hex byte * string (must have an even number of hex chars). Pass `"0x"` for * empty metadata. * @throws whatever the injected `writeContract` throws * @throws `AbortError` / caller-provided abort reason if `signal` aborts */ export declare function activateVault(input: ActivateVaultInput): Promise; export interface ActivateVaultAndRedeemInput { /** BTCVaultRegistry contract address (env-specific). */ btcVaultRegistryAddress: Address; /** Vault ID (bytes32, 0x-prefixed). */ vaultId: Hex; /** * HTLC secret preimage (bytes32). A missing `0x` prefix or an uppercase * `0X` prefix is normalised before validation. */ secret: string; /** * Optional hashlock for client-side pre-validation. When provided, the SDK * rejects before calling `writeContract` if `sha256(secret) != hashlock`. */ hashlock?: Hex; /** Caller-provided write callback — see {@link EthContractWriter}. */ writeContract: EthContractWriter; /** * Optional abort signal. Checked before validation runs; since validation * is fully synchronous, cancellation between validation and the write is * not observable and callers should rely on the transport's own * cancellation support for that window. */ signal?: AbortSignal; } /** * Depositor escape hatch: reveal the HTLC secret and immediately redeem the * vault for the depositor, without any application activation. The contract * (`activateVaultWithSecretAndRedeem`) runs the same activation preconditions * (Verified status, activation deadline, `sha256(s) == hashlock`) and then * marks the vault Redeemed so the vault provider pays the BTC out to the * depositor's committed payout address. Used when the normal activation is * unavailable (e.g. the application adapter is paused or its activation * reverts) but the secret must still be revealed to recover the swept peg-in. * * Takes no activation metadata — the application entry point is never called. * * @throws `Error` if `btcVaultRegistryAddress` is not a valid 20-byte address * @throws `Error` if `vaultId` or `secret` is not a valid 32-byte hex * @throws `Error` if `hashlock` is provided and is not a valid 32-byte hex, * or if `sha256(secret) != hashlock` * @throws whatever the injected `writeContract` throws * @throws `AbortError` / caller-provided abort reason if `signal` aborts */ export declare function activateVaultAndRedeem(input: ActivateVaultAndRedeemInput): Promise; //# sourceMappingURL=activateVault.d.ts.map