import { type Address } from "viem"; import { type Deallocation, type Metadata, type Transaction, type VaultV2ForceWithdrawAction } from "../../types/index.js"; /** Parameters for {@link vaultV2ForceWithdraw}. */ export interface VaultV2ForceWithdrawParams { vault: { address: Address; }; args: { deallocations: readonly Deallocation[]; withdraw: { amount: bigint; recipient: Address; }; onBehalf: Address; }; metadata?: Metadata; } /** * Prepares a force-withdraw transaction for a VaultV2 contract via the vault's native `multicall`. * * Encodes one or more `forceDeallocate` calls followed by a single `withdraw`, executed * atomically through VaultV2's `multicall`. Frees liquidity from non-liquidity adapters and * withdraws the resulting assets in one transaction. * * A penalty is taken from `onBehalf` for each deallocation to discourage allocation * manipulation. The penalty is applied as a share burn where assets are returned to the vault, * so the share price stays stable (except for rounding). * * @param params.vault.address - The VaultV2 address. * @param params.args.deallocations - The deallocations to perform before withdrawing. Must be * non-empty. * @param params.args.withdraw.amount - Amount of underlying assets to withdraw after the * deallocations complete. * @param params.args.withdraw.recipient - Address that receives the withdrawn assets. * @param params.args.onBehalf - Address whose shares are burned and from which the deallocation * penalty is taken. * @param params.metadata - Optional analytics metadata attached to the multicall transaction. * @returns A deep-frozen `Transaction` with `to`, `value`, `data`, * and the typed `action` discriminator the simulation layer consumes. * @throws {EmptyDeallocationsError} when `deallocations` is empty. * @throws {NonPositiveInputError} when `withdraw.amount <= 0n`, or when any * `deallocations[i].amount <= 0n` (raised by `encodeForceDeallocateCall`). * @example * ```ts * import { vaultV2ForceWithdraw } from "@morpho-org/morpho-sdk"; * * const tx = vaultV2ForceWithdraw({ * vault: { address: vaultAddress }, * args: { * deallocations: [{ adapter, marketParams, amount: 500_000n }], * withdraw: { amount: 500_000n, recipient }, * onBehalf, * }, * }); * // tx satisfies Readonly> * ``` */ export declare const vaultV2ForceWithdraw: ({ vault: { address: vaultAddress }, args: { deallocations, withdraw, onBehalf }, metadata, }: VaultV2ForceWithdrawParams) => Readonly>;