Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Nov 8, 2023
1 parent 7c68992 commit ed1d118
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/multicall/impl/multicall.viem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit ed1d118

Please sign in to comment.