import { type Address, type Log } from "viem"; import { AddressMap } from "../sdk/index.js"; import type { ExecuteResult } from "./internal-types.js"; import type { DirectTransferInfo } from "./types.js"; type RawLog = Log; /** * Effective `withdrawCollateral` outcome decoded from the facade's * `WithdrawCollateral` event. */ export interface WithdrawCollateralEventInfo { /** * For regular withdrawals: the calldata token. * For phantom withdrawals: the deposited (resolved) token. */ token: Address; amount: bigint; to: Address; } /** * Extracts per-adapter-call token balance changes and detects direct * incoming transfers to the credit account. * * @param logs - raw viem Log[] from transaction receipt, sorted by logIndex * @param facadeAddress - the credit facade address (sole boundary event source) * @param creditAccount - the credit account address to track */ export interface ExtractTransfersResult { executeResults: ExecuteResult[]; directTransfers: DirectTransferInfo[]; liquidationRemainingFunds?: bigint; /** Maps phantom token address to its deposited (underlying) token address. */ phantomTokens: AddressMap
; /** * One entry per facade `WithdrawCollateral` event targeting `creditAccount`, * in transaction order. Used to recover the effective amount when the * calldata uses the `type(uint256).max` "withdraw all" sentinel. */ withdrawCollateralEvents: WithdrawCollateralEventInfo[]; } export declare function extractTransfers(logs: RawLog[], creditAccount: Address, pool: Address, creditFacade: Address): ExtractTransfersResult; export {};