Skip to content

Commit

Permalink
fix(provider): estimation fee response type
Browse files Browse the repository at this point in the history
  • Loading branch information
MilGard91 committed Mar 16, 2022
1 parent e40204a commit ce674ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/provider/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
CompiledContract,
DeployContractPayload,
Endpoints,
EstimateFeeResponse,
GetBlockResponse,
GetCodeResponse,
GetContractAddressesResponse,
Expand Down Expand Up @@ -338,7 +339,7 @@ export class Provider implements ProviderInterface {
});
}

public estimateFee(invocation: Invocation): Promise<any> {
public estimateFee(invocation: Invocation): Promise<EstimateFeeResponse> {
return this.fetchEndpoint('estimate_fee', undefined, {
contract_address: invocation.contractAddress,
entry_point_selector: getSelectorFromName(invocation.entrypoint),
Expand Down
3 changes: 2 additions & 1 deletion src/provider/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
Call,
CallContractResponse,
DeployContractPayload,
EstimateFeeResponse,
GetBlockResponse,
GetCodeResponse,
GetContractAddressesResponse,
Expand Down Expand Up @@ -150,7 +151,7 @@ export abstract class ProviderInterface {
*
* @returns response from addTransaction
*/
public abstract estimateFee(invocation: Invocation): Promise<any>;
public abstract estimateFee(invocation: Invocation): Promise<EstimateFeeResponse>;

public abstract waitForTransaction(txHash: BigNumberish, retryInterval?: number): Promise<void>;

Expand Down
7 changes: 5 additions & 2 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit ce674ca

Please sign in to comment.