diff --git a/src/account/default.ts b/src/account/default.ts index 77aff51ff..910f703ff 100644 --- a/src/account/default.ts +++ b/src/account/default.ts @@ -2,7 +2,6 @@ import assert from 'minimalistic-assert'; import { ZERO } from '../constants'; import { Provider, ProviderInterface } from '../provider'; -import { BlockIdentifier } from '../provider/utils'; import { Signer, SignerInterface } from '../signer'; import { Abi, @@ -15,7 +14,7 @@ import { Signature, Transaction, } from '../types'; -import { EstimateFee } from '../types/account'; +import { EstimateFee, EstimateFeeDetails } from '../types/account'; import { sign } from '../utils/ellipticCurve'; import { computeHashOnElements, @@ -56,10 +55,7 @@ export class Account extends Provider implements AccountInterface { public async estimateFee( calls: Call | Call[], - { - nonce: providedNonce, - blockIdentifier = 'pending', - }: { nonce?: BigNumberish; blockIdentifier?: BlockIdentifier } = {} + { nonce: providedNonce, blockIdentifier = 'pending' }: EstimateFeeDetails = {} ): Promise { const transactions = Array.isArray(calls) ? calls : [calls]; const nonce = providedNonce ?? (await this.getNonce()); diff --git a/src/account/interface.ts b/src/account/interface.ts index f994a4691..7b0909619 100644 --- a/src/account/interface.ts +++ b/src/account/interface.ts @@ -5,11 +5,10 @@ import { AddTransactionResponse, Call, DeployContractPayload, - Invocation, InvocationsDetails, Signature, } from '../types'; -import { EstimateFee } from '../types/account'; +import { EstimateFee, EstimateFeeDetails } from '../types/account'; import { BigNumberish } from '../utils/number'; import { TypedData } from '../utils/typedData/types'; @@ -44,7 +43,10 @@ export abstract class AccountInterface extends ProviderInterface { * * @returns response from addTransaction */ - public abstract estimateFee(invocation: Invocation): Promise; + public abstract estimateFee( + calls: Call | Call[], + estimateFeeDetails?: EstimateFeeDetails + ): Promise; /** * Invoke execute function in account contract diff --git a/src/types/account.ts b/src/types/account.ts index 75bdafc7b..f681905ea 100644 --- a/src/types/account.ts +++ b/src/types/account.ts @@ -1,7 +1,14 @@ import BN from 'bn.js'; +import { BlockIdentifier } from '../provider/utils'; +import { BigNumberish } from '../utils/number'; import { EstimateFeeResponse } from './api'; export interface EstimateFee extends EstimateFeeResponse { suggestedMaxFee: BN; } + +export interface EstimateFeeDetails { + nonce?: BigNumberish; + blockIdentifier?: BlockIdentifier; +} diff --git a/src/types/index.ts b/src/types/index.ts index e82e5a511..f0de882f6 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -2,3 +2,4 @@ export * from './lib'; export * from './api'; export * from './signer'; export * from './contract'; +export * from './account';