import type { IAddress, ITokenizedVault } from '../../types'; /** * Per-vault on-chain reads resolved ahead of the positions fan-out, so * `getVaultPositions` / `getVaultAvailableRedemptions` can skip their own * `balanceOf` / `lagDuration` RPCs. A missing field means the read was not * (or could not be) prefetched — the getter falls back to its own call. * @internal */ export interface IPrefetchedVaultReads { /** Raw share/receipt-token balance of the wallet (`balanceOf`). */ balance?: bigint; /** Vault redemption lag in seconds (`lagDuration`). */ lagDuration?: number; } /** * Minimal shape of a backend tokenized-vault row the prefetch needs. The * full backend response type is looser than this; only these fields are read. * @internal */ interface IPrefetchableVault { address: string; chain: number; chain_type?: string; /** * Backend vault kind. `getVaultVersionV2` reads this to classify evm-2 * (`multiAssetVault`) vaults whose address isn't in the hardcoded * `MULTI_ASSET_VAULTS` list; without it such a vault would be misclassified * as evm-1 and the batch would target the vault itself for `balanceOf` * instead of its receipt token. */ internal_type?: ITokenizedVault['internal_type']; } /** * Batch the two non-cacheable per-vault reads (`balanceOf`, `lagDuration`) * for a vault list via Multicall3, grouped by chain, ahead of the per-vault * positions fan-out. * * Scope and fallback rules (task 52): * - Only EVM vaults on chains with a configured provider AND a verified * Multicall3 deployment are batched. Solana/Stellar vaults, unverified * chains (e.g. Citrea 4114), and provider-less chains are skipped — they * keep today's exact per-vault read path. * - `balanceOf` targets the receipt token for evm-2 vaults (resolved through * the same cached `getReceiptTokenAddress` the getters use) and the vault * itself for evm-1. Without an EVM wallet only `lagDuration` is batched. * - Failures never propagate: a reverting vault call is simply absent from * the result map, and a whole-chain error drops that chain's entries. The * worst case is always "no prefetch → per-vault fallback", never wrong data. * * RPC cost: per batched chain, `ceil(reads / 10)` `eth_call`s (+1 cold * `lpTokenAddress` per evm-2 vault) instead of ~2 `eth_call`s per vault. * * @param vaults Backend tokenized-vault rows about to be fanned out over. * @param wallet Optional EVM wallet for `balanceOf` reads. * @param providers Chain-id → RPC-url map (the module's `this.providers`). * @returns Map keyed by lowercased vault address; vaults with no batched * reads have no entry. * @internal */ export declare function prefetchVaultPositionReads({ vaults, wallet, providers, }: { vaults: IPrefetchableVault[]; wallet?: IAddress; providers?: Partial>; }): Promise>; export {};