diff --git a/src/multicall/impl/multicall.ethers.ts b/src/multicall/impl/multicall.ethers.ts index 65dab518d..89231c06d 100644 --- a/src/multicall/impl/multicall.ethers.ts +++ b/src/multicall/impl/multicall.ethers.ts @@ -7,17 +7,18 @@ import { Multicall } from '~contract/contracts'; import { DEFAULT_DATALOADER_OPTIONS } from '../multicall.constants'; import { MulticallContract } from '../multicall.contract'; import { ContractCall, IMulticallWrapper, TargetContract } from '../multicall.interface'; +import { MulticallCallStruct } from '~multicall/multicall.types'; export const isMulticallUnderlyingError = (err: Error) => err.message.includes('Multicall call failed for'); export type MulticallCallbackHooks = { - beforeCallHook?: (calls: ContractCall[], callRequests: Multicall.CallStruct[]) => void; + beforeCallHook?: (calls: ContractCall[], callRequests: MulticallCallStruct[]) => void; }; export class EthersMulticallDataLoader implements IMulticallWrapper { private multicall: Multicall; private dataLoader: DataLoader; - private beforeCallHook?: (calls: ContractCall[], callRequests: Multicall.CallStruct[]) => void; + private beforeCallHook?: (calls: ContractCall[], callRequests: MulticallCallStruct[]) => void; constructor( multicall: Multicall, diff --git a/src/multicall/impl/multicall.viem.ts b/src/multicall/impl/multicall.viem.ts index b4523a095..6035c9b67 100644 --- a/src/multicall/impl/multicall.viem.ts +++ b/src/multicall/impl/multicall.viem.ts @@ -16,6 +16,7 @@ import { MulticallWrappedReadRequestError } from '~multicall/errors/multicall.re import { DEFAULT_DATALOADER_OPTIONS } from '~multicall/multicall.constants'; import { MulticallWrappedReadDecodeError } from '../errors/multicall.decode.error'; +import { MulticallCallStruct } from '~multicall/multicall.types'; declare module 'abitype' { export interface Config { @@ -35,20 +36,15 @@ export type ContractCall = { stack?: string; }; -type CallStruct = { - target: string; - callData: string; -}; - type MulticallCallbackHooks = { - beforeCallHook?: (calls: ContractCall[], callRequests: CallStruct[]) => void; + beforeCallHook?: (calls: ContractCall[], callRequests: MulticallCallStruct[]) => void; afterResultSerializer?: (result: ReadContractReturnType) => unknown; }; export class ViemMulticallDataLoader { private multicall: MulticallContract; private dataLoader: DataLoader; - private beforeCallHook?: (calls: ContractCall[], callRequests: CallStruct[]) => void; + private beforeCallHook?: (calls: ContractCall[], callRequests: MulticallCallStruct[]) => void; private afterResultSerializer?: (result: ReadContractReturnType) => unknown; constructor( diff --git a/src/multicall/multicall.types.ts b/src/multicall/multicall.types.ts new file mode 100644 index 000000000..9a11fac08 --- /dev/null +++ b/src/multicall/multicall.types.ts @@ -0,0 +1,4 @@ +export type MulticallCallStruct = { + target: string; + callData: string; +};