From ed1d11843b071a0052f38d004e824f5e90bea44c Mon Sep 17 00:00:00 2001 From: Karan Shahani Date: Wed, 8 Nov 2023 13:20:56 -0500 Subject: [PATCH] Done --- src/multicall/impl/multicall.viem.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/multicall/impl/multicall.viem.ts b/src/multicall/impl/multicall.viem.ts index b4523a095..d45395637 100644 --- a/src/multicall/impl/multicall.viem.ts +++ b/src/multicall/impl/multicall.viem.ts @@ -77,10 +77,12 @@ export class ViemMulticallDataLoader { })); if (this.beforeCallHook) this.beforeCallHook(calls, callRequests); - const { result: res } = await this.multicall.simulate.aggregate([callRequests, false]); + const { + result: [success, data], + } = await this.multicall.simulate.aggregate([callRequests, false]); - if (res[1].length !== callRequests.length) { - throw new Error(`Unexpected response length: received ${res[1].length}; expected ${callRequests.length}`); + if (data.length !== callRequests.length) { + throw new Error(`Unexpected response length: received ${data.length}; expected ${callRequests.length}`); } const result: (ReadContractReturnType | Error)[] = calls.map(({ abi, functionName, args, address, stack }, i) => {