Skip to content

Commit

Permalink
fix: properly parse blockIdentifier in buildCall function
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarmitic committed Nov 28, 2022
1 parent 4186e8b commit d09affd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/contract/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
AbiEntry,
Args,
AsyncContractFunction,
BlockTag,
Call,
Calldata,
ContractFunction,
Expand Down Expand Up @@ -36,7 +37,15 @@ function parseFelt(candidate: string): BN {
*/
function buildCall(contract: Contract, functionAbi: FunctionAbi): AsyncContractFunction {
return async function (...args: Array<any>): Promise<any> {
return contract.call(functionAbi.name, args);
let blockIdentifier: BlockTag | null = null;

args.forEach((arg) => {
if (arg.blockIdentifier) {
blockIdentifier = arg.blockIdentifier;
}
});

return contract.call(functionAbi.name, args, { blockIdentifier });
};
}

Expand Down

0 comments on commit d09affd

Please sign in to comment.