import type { MarketId } from "@morpho-org/blue-sdk"; import type { PublicReallocation } from "@morpho-org/morpho-sdk"; import { ReallocationData } from "@morpho-org/morpho-sdk/entities"; import DataLoader from "dataloader"; import type { Chain, Client, Transport } from "viem"; /** * Optional tuning for the shared-liquidity source-market withdrawal ceiling. * * @deprecated Vault V1 PublicAllocator liquidity planning is deprecated. Use * `VaultV2BluePublicAllocatorOptions` from `@morpho-org/morpho-sdk` instead. */ export interface LiquidityParameters { /** * The default maximum utilization allowed to reach to find shared liquidity (scaled by WAD). * * @default 90% (900000000000000000n) * @deprecated Use `VaultV2BluePublicAllocatorOptions.maxWithdrawalUtilization` * with the Vault V2 BluePublicAllocator planner in `@morpho-org/morpho-sdk`. */ defaultMaxWithdrawalUtilization?: bigint; /** * If provided, defines the maximum utilization allowed to reach for each market, defaulting to `defaultMaxWithdrawalUtilization`. * * @deprecated Vault V1 PublicAllocator liquidity planning and per-market source * ceilings are deprecated. Use `VaultV2BluePublicAllocatorOptions.maxWithdrawalUtilization` * with the Vault V2 BluePublicAllocator planner in `@morpho-org/morpho-sdk`. */ maxWithdrawalUtilization?: Record; } /** * Batches Vault V1 PublicAllocator liquidity planning from API and onchain state. * * @deprecated Use `MorphoBlue.getVaultV2BlueReallocationData` and * `MorphoBlue.getVaultV2BlueReallocations` from `@morpho-org/morpho-sdk` instead. */ export declare class LiquidityLoader { client: Client; /** Shared-liquidity source-market withdrawal tuning. */ readonly parameters: LiquidityParameters; protected readonly dataLoader: DataLoader; constructor(client: Client, /** Shared-liquidity source-market withdrawal tuning. */ parameters?: LiquidityParameters); /** * Fetches the shared-liquidity plan for a target market from the Morpho API and onchain state. * * @deprecated Use `MorphoBlue.getVaultV2BlueReallocationData` and * `MorphoBlue.getVaultV2BlueReallocations` from `@morpho-org/morpho-sdk` instead. * * @param marketId - Target market id to plan withdrawals for. * @returns The start state, simulated end state, computed withdrawals, and target borrow utilization. * * @remarks The returned `endState` is produced by `ReallocationData.getMarketPublicReallocations` * from onchain inputs fetched at one block, with reallocation headroom evaluated one hour after * that block timestamp. * * @example * ```ts * import type { MarketId } from "@morpho-org/blue-sdk"; * import { LiquidityLoader } from "@morpho-org/liquidity-sdk-viem"; * import { createPublicClient, http } from "viem"; * import { mainnet } from "viem/chains"; * * const client = createPublicClient({ * chain: mainnet, * transport: http("https://rpc.example"), * }); * const loader = new LiquidityLoader(client); * * const marketId = * "0x7bbbb127f5d2886295f50f3cdf86231d9ff45f248639ee1fd3f2bd5d8b129dcf" as MarketId; * const { withdrawals, endState } = await loader.fetch(marketId); * * // withdrawals: readonly PublicReallocation[] * // endState: ReallocationData * ``` */ fetch(marketId: MarketId): Promise<{ startState: ReallocationData; endState: ReallocationData; withdrawals: readonly PublicReallocation[]; targetBorrowUtilization: bigint; }>; }