Skip to content

Commit

Permalink
fix: estimateFee and call block id
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Sep 15, 2022
1 parent 5348c39 commit ef1645f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/provider/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class RpcProvider implements ProviderInterface {
blockIdentifier: BlockIdentifier = 'pending',
invocationDetails: InvocationsDetails = {}
): Promise<EstimateFeeResponse> {
const block_id = new Block(blockIdentifier).identifier;
return this.fetchEndpoint('starknet_estimateFee', [
{
contract_address: invocation.contractAddress,
Expand All @@ -206,7 +207,7 @@ export class RpcProvider implements ProviderInterface {
signature: bigNumberishArrayToHexadecimalStringArray(invocation.signature || []),
version: toHex(toBN(invocationDetails?.version || 0)),
},
blockIdentifier,
block_id,
]).then(this.responseParser.parseFeeEstimateResponse);
}

Expand Down Expand Up @@ -265,13 +266,14 @@ export class RpcProvider implements ProviderInterface {
call: Call,
blockIdentifier: BlockIdentifier = 'pending'
): Promise<CallContractResponse> {
const block_id = new Block(blockIdentifier).identifier;
const result = await this.fetchEndpoint('starknet_call', [
{
contract_address: call.contractAddress,
entry_point_selector: getSelectorFromName(call.entrypoint),
calldata: parseCalldata(call.calldata),
},
blockIdentifier,
block_id,
]);

return this.responseParser.parseCallContractResponse(result);
Expand Down

0 comments on commit ef1645f

Please sign in to comment.