Skip to content

Commit

Permalink
Merge pull request #100 from HadiEsna/master
Browse files Browse the repository at this point in the history
fixing blocknumber issue
  • Loading branch information
joshstevens19 authored Aug 8, 2024
2 parents 7db5646 + c74a112 commit 94c7898
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,18 @@ export class Multicall {
Multicall.ABI,
this.getContractBasedOnNetwork(networkId)
);
const callParams = [];
// const callParams = [];
let blockNumber = 'latest';
if (options.blockNumber) {
callParams.push(options.blockNumber);
blockNumber = options.blockNumber;
}
if (this._options.tryAggregate) {
const contractResponse = (await contract.methods
.tryBlockAndAggregate(
false,
this.mapCallContextToMatchContractFormat(calls)
)
.call(...callParams)) as AggregateContractResponse;
.call({}, blockNumber)) as AggregateContractResponse;

contractResponse.blockNumber = BigNumber.from(
contractResponse.blockNumber
Expand All @@ -403,7 +404,7 @@ export class Multicall {
} else {
const contractResponse = (await contract.methods
.aggregate(this.mapCallContextToMatchContractFormat(calls))
.call(...callParams)) as AggregateContractResponse;
.call({}, blockNumber)) as AggregateContractResponse;

contractResponse.blockNumber = BigNumber.from(
contractResponse.blockNumber
Expand Down

0 comments on commit 94c7898

Please sign in to comment.