import { ChainId, TxCall } from "../../model/primitives.js"; import { LiquidatableAccount, LiquidationDetails, LiquidationPosition } from "../../model/liquidations.js"; import { DataResponse } from "../../model/response.js"; import "../../model/index.js"; import { BuildLiquidationTxProps, BuildPartialLiquidationTxProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationPositionsProps, GetPartialLiquidationDetailsProps } from "../../onchain/accounts/liquidations/types.js"; import { CheckLiquidationInput, CheckLiquidationOptions, LiquidationValidationError } from "../../onchain/validation/checkLiquidation.js"; import "../../onchain/index.js"; import { Address } from "viem"; //#region src/sdk/liquidations/types.d.ts /** * On-chain discovery of liquidatable credit accounts and delayed-withdrawal * positions a liquidator wallet holds. **/ export interface ILiquidations { /** * All liquidatable credit accounts: health factor below 1 plus accounts of * expired credit managers with outstanding debt. Optionally narrowed. **/ getLiquidatableAccounts(props?: GetLiquidatableAccountsProps): Promise>; /** * Detailed view of one liquidatable credit account, including the assets the * liquidator receives. Throws when the chain cannot answer. **/ getLiquidationDetails(props: GetLiquidationDetailsProps): Promise>; /** * Partial liquidation of one credit account, in the shape of a full one: * what the liquidator pays, receives and must approve. A local estimate from * the synced oracle state. Parameters left out are derived from current * state. Throws for RWA markets and withdrawal phantom collateral. **/ getPartialLiquidationDetails(props: GetPartialLiquidationDetailsProps): Promise>; /** * Transaction that fully liquidates a credit account. The reported block is * the one the transaction was built against. **/ buildLiquidationTx(props: BuildLiquidationTxProps): Promise>; /** * Transaction that partially liquidates a credit account, sending the * seized collateral to the liquidator. The reported block is the one the * transaction was built against. Throws when the account cannot be * partially liquidated. **/ buildPartialLiquidationTx(props: BuildPartialLiquidationTxProps): Promise>; /** * Delayed-withdrawal positions (redemption receipts) owned by a liquidator * wallet, optionally scoped to some of the SDK's chains. **/ getLiquidationPositions(props: GetLiquidationPositionsProps): Promise>; /** * Whether `liquidator` may send a full or partial liquidation of this * account. * * `details` must come from {@link ILiquidations.getLiquidationDetails} * called with the same `liquidator`, or from * {@link ILiquidations.getPartialLiquidationDetails}. **/ checkLiquidation(props: CheckLiquidationInput, options?: CheckLiquidationOptions): Promise; /** * Whether `liquidator` may liquidate while the facade is paused; `false` when unknown. **/ isEmergencyLiquidator(props: IsEmergencyLiquidatorProps): boolean; } export interface IsEmergencyLiquidatorProps { chainId: ChainId; creditManager: Address; liquidator: Address; } /** * `sdk.liquidations` per mode: an on-chain read, absent when the SDK reads no * chain. **/ export interface ILiquidationsByMode { onchain: ILiquidations; offchain: undefined; both: ILiquidations; } //#endregion