import { type MarketInput } from "@morpho-org/midnight-sdk"; import { type Address } from "viem"; import { type Metadata, type MidnightRedeemAction, type Transaction } from "../../types/index.js"; /** Parameters for encoding a direct Midnight credit redemption. */ export interface MidnightRedeemParams { readonly chainId: number; readonly market: MarketInput; readonly units: bigint; readonly onBehalf: Address; readonly receiver?: Address; readonly metadata?: Metadata; } /** * Encodes a direct Midnight credit redemption. * * Use this low-level builder after the caller has fetched and checked position * credit and market withdrawable liquidity. App flows should usually call * `client.morpho.midnight(chainId).redeem(...)`, which performs those checks * from the supplied `positionData` snapshot before exposing `buildTx`. * * @param params.chainId - Chain id used to resolve `Midnight`. * @param params.market - Midnight market whose credit is redeemed. * @param params.units - Credit units to withdraw. * @param params.onBehalf - Account whose credit balance is reduced. * @param params.receiver - Optional receiver for withdrawn loan assets; defaults to `onBehalf`. * @param params.metadata - Optional analytics metadata appended to calldata. * @returns A deep-frozen `Transaction` targeting `Midnight`. * @throws {NonPositiveInputError} when `units <= 0n`. * @throws {ChainIdMismatchError} when the market targets another chain. * @throws {MidnightMarketAddressMismatchError} when the market targets another Midnight deployment. * @example * ```ts * import { midnightRedeem } from "@morpho-org/morpho-sdk"; * * const tx = midnightRedeem({ * chainId: 8453, * market: marketData.params, * units: positionData.faceValue, * onBehalf: user, * }); * ``` */ export declare const midnightRedeem: (params: MidnightRedeemParams) => Readonly>;