From ce674ca632ff70a07d95d685c9bf2f48bebaca20 Mon Sep 17 00:00:00 2001 From: Miljan Milidrag Date: Wed, 16 Mar 2022 08:54:57 +0100 Subject: [PATCH] fix(provider): estimation fee response type --- src/provider/default.ts | 3 ++- src/provider/interface.ts | 3 ++- src/types/api.ts | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/provider/default.ts b/src/provider/default.ts index cbbc135e5..5fc19b945 100644 --- a/src/provider/default.ts +++ b/src/provider/default.ts @@ -9,6 +9,7 @@ import { CompiledContract, DeployContractPayload, Endpoints, + EstimateFeeResponse, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, @@ -338,7 +339,7 @@ export class Provider implements ProviderInterface { }); } - public estimateFee(invocation: Invocation): Promise { + public estimateFee(invocation: Invocation): Promise { return this.fetchEndpoint('estimate_fee', undefined, { contract_address: invocation.contractAddress, entry_point_selector: getSelectorFromName(invocation.entrypoint), diff --git a/src/provider/interface.ts b/src/provider/interface.ts index 4c1f8dd06..cbac38ba5 100644 --- a/src/provider/interface.ts +++ b/src/provider/interface.ts @@ -3,6 +3,7 @@ import type { Call, CallContractResponse, DeployContractPayload, + EstimateFeeResponse, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, @@ -150,7 +151,7 @@ export abstract class ProviderInterface { * * @returns response from addTransaction */ - public abstract estimateFee(invocation: Invocation): Promise; + public abstract estimateFee(invocation: Invocation): Promise; public abstract waitForTransaction(txHash: BigNumberish, retryInterval?: number): Promise; diff --git a/src/types/api.ts b/src/types/api.ts index b8221db69..ce9c531e0 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -222,8 +222,11 @@ export type TransactionReceipt = { l2_to_l1_messages: string[]; events: string[]; }; -// TODO: Add response data -export type EstimateFeeResponse = {}; + +export type EstimateFeeResponse = { + amount: number; + unit: string; +}; export type RawArgs = { [inputName: string]: string | string[] | { type: 'struct'; [k: string]: BigNumberish };