import { type InterfaceAbi } from 'ethers'; import type { IAddress, IContractRunner } from '../../types'; /** * One read to fold into a Multicall3 `aggregate3` batch. * @internal */ export interface IMulticall3Request { /** Contract to call. */ target: IAddress; /** ABI containing `functionName` (full or minimal fragment). */ abi: InterfaceAbi; /** View function to encode. */ functionName: string; /** Positional arguments for the function. */ args?: unknown[]; } /** * Per-call result of an `aggregate3` batch. `success: false` means that one * call reverted (or its chunk failed at the transport level) — it never * implies anything about the other calls in the batch. * @internal */ export interface IMulticall3Result { success: boolean; /** First decoded return value; `undefined` when `success` is `false`. */ value?: unknown; } /** * Calls per `aggregate3` chunk. Mirrors the `batchMaxCount: 10` cap on * `createProvider` — some RPC providers (e.g. rpc.hypurrscan.io) enforce * their own batch/response-size limits, so an unbounded batch for a wallet * with many vaults risks exceeding response-size or `eth_call` gas ceilings. * @internal */ export declare const MULTICALL3_BATCH_SIZE = 10; /** * Whether Multicall3 read-aggregation is enabled for a chain. Only chains in * {@link MULTICALL3_VERIFIED_CHAINS} (deployment verified via `eth_getCode`, * never assumed) qualify — callers must fall back to individual reads for * every other chain. * @internal */ export declare function isMulticall3Supported(chainId: number | undefined): boolean; /** * Aggregate independent view calls into chunked Multicall3 `aggregate3` * batches (`allowFailure: true` per call). * * Failure semantics — the load-bearing detail: * - A reverting inner call (paused/deprecated vault) yields `success: false` * for that call only; every other call in the batch decodes normally. * - A transport-level failure of one chunk degrades that chunk's calls to * `success: false` instead of throwing, so a caller can always fall back * to its per-call path. This function never rejects for RPC reasons. * * RPC cost: `ceil(calls.length / batchSize)` `eth_call`s, versus * `calls.length` without aggregation. * * @param provider Provider for the target chain. * @param chainId Chain the provider is connected to — must be in the * verified allowlist; gate with {@link isMulticall3Supported} first. * @param calls Reads to aggregate, in order. * @param batchSize Max calls per `aggregate3` chunk. * @returns One {@link IMulticall3Result} per request, index-aligned. * @throws AugustValidationError when `chainId` is not on the verified * allowlist — programming error, not a runtime condition to swallow. * @internal */ export declare function multicall3Aggregate(provider: IContractRunner, chainId: number, calls: IMulticall3Request[], batchSize?: number): Promise;