Skip to content

Commit

Permalink
Merge pull request #127 from dan-ziv/feat/pass-block-identifier-throu…
Browse files Browse the repository at this point in the history
…gh-contract-calls
  • Loading branch information
janek26 authored Feb 9, 2022
2 parents 41fb871 + e34dd86 commit be2ec9e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BN from 'bn.js';
import assert from 'minimalistic-assert';

import { Provider, defaultProvider } from './provider';
import { BlockIdentifier } from './provider/utils';
import { Abi, AbiEntry, FunctionAbi, Signature, StructAbi } from './types';
import { BigNumberish, toBN } from './utils/number';
import { getSelectorFromName } from './utils/stark';
Expand Down Expand Up @@ -166,7 +167,7 @@ export class Contract {
});
}

public async call(method: string, args: Args = {}) {
public async call(method: string, args: Args = {}, blockIdentifier: BlockIdentifier = null) {
// ensure contract is connected
assert(this.connectedTo !== null, 'contract isnt connected to an address');

Expand All @@ -178,11 +179,14 @@ export class Contract {
const calldata = compileCalldata(args);

return this.provider
.callContract({
contract_address: this.connectedTo,
calldata,
entry_point_selector: entrypointSelector,
})
.callContract(
{
contract_address: this.connectedTo,
calldata,
entry_point_selector: entrypointSelector,
},
blockIdentifier
)
.then((x) => this.parseResponse(method, x.result));
}
}

0 comments on commit be2ec9e

Please sign in to comment.