import { Contract } from 'ethers'; /** * Call structure for multicall */ export interface MulticallCall { target: string; callData: string; } /** * Result structure from multicall */ export interface MulticallResult { blockNumber: number; returnData: string[]; } /** * Multicall RPC * Allows batching multiple contract view calls into a single request */ export declare class MulticallRPC { private multicallContract; constructor(multicallContract: Contract); /** * Execute multiple calls in a single transaction * @param calls - Array of calls to execute * @returns Block number and return data from each call */ aggregate(calls: MulticallCall[]): Promise; /** * Helper: Create call data for a contract function * @param contract - Contract instance * @param functionName - Function name * @param args - Function arguments * @returns Call data object */ createCall(contract: Contract, functionName: string, args?: any[]): MulticallCall; /** * Helper: Decode return data from a multicall result * @param contract - Contract instance used for decoding * @param functionName - Function name that was called * @param returnData - Raw return data from multicall * @returns Decoded result */ decodeResult(contract: Contract, functionName: string, returnData: string): any; /** * Execute multicall and decode results * @param calls - Array of call definitions with contract and function info * @returns Decoded results */ aggregateAndDecode(calls: Array<{ contract: Contract; functionName: string; args?: any[]; }>): Promise<{ blockNumber: number; results: any[]; }>; /** * Batch read multiple open trades * @param tradingStorageContract - TradingStorage contract instance * @param trader - Trader address * @param pairIndex - Pair index * @param indices - Array of trade indices * @returns Array of decoded trade data */ batchGetOpenTrades(tradingStorageContract: Contract, trader: string, pairIndex: number, indices: number[]): Promise; /** * Batch read multiple trade infos * @param tradingStorageContract - TradingStorage contract instance * @param trader - Trader address * @param pairIndex - Pair index * @param indices - Array of trade indices * @returns Array of decoded trade info data */ batchGetOpenTradesInfo(tradingStorageContract: Contract, trader: string, pairIndex: number, indices: number[]): Promise; /** * Batch read pair information * @param pairStorageContract - PairStorage contract instance * @param pairIndices - Array of pair indices * @returns Array of decoded pair data */ batchGetPairs(pairStorageContract: Contract, pairIndices: number[]): Promise; }