The GasModule handles gas related operations and provides convenient methods for estimating the gas cost of a transaction.

Constructors

Properties

httpClient: HttpClient
transactionsModule: TransactionModuleInterface

Methods

  • Simulates a transaction and returns an object containing information regarding the gas used and whether the transaction reverted.

    Parameters

    • clauses: TransactionClause[]

      The clauses of the transaction to simulate.

    • Optionalcaller: string

      The address of the account sending the transaction.

    • Optionaloptions: EstimateGasOptions

      Optional parameters for the request. Includes all options of the simulateTransaction method excluding the caller option.

    Returns Promise<EstimateGasResult>

    An object containing information regarding the gas used and whether the transaction reverted, together with the decoded revert reason and VM errors. @throws{InvalidDataType}

    The caller option is suggested as estimation without this parameter may not be accurate.

    TransactionsClient#simulateTransaction Also, includes the gasPadding option which is a percentage of gas to add on top of the estimated gas. The value must be between (0, 1].

  • Returns the suggested priority fee per gas in wei. This is calculated based on the current base fee and network conditions.

    Returns Promise<string>

    Suggested priority fee per gas in wei (hex string)

  • Sets the transactions module.

    Parameters

    • transactionsModule: TransactionModuleInterface

      The transactions module to set.

    Returns void