Creates a new EVMGasEstimator instance
The SupportedChain to estimate gas for
The RPC client for making blockchain requests
Map of EntryPointVersion to their contract instances
Optional gas limits for simulation, defaults to predefined constants
The SupportedChain to estimate gas for
Map of EntryPointVersion to their contract instances
Protected
rpcThe RPC client for making blockchain requests
Optional gas limits for simulation, defaults to predefined constants
Estimates the pre-verification gas for a user operation on Optimism. Includes both L2 execution gas and L1 data posting costs, adjusted by the L2 price.
The UserOperation to estimate gas for
The current base fee per gas, required for Optimism calculations
The total pre-verification gas estimate as a bigint
Estimates all gas parameters for a user operation.
The estimation parameters
Parameters for estimating user operation gas.
Current base fee per gas
Optional
options?: Partial<EstimateUserOperationGasOptions>Additional estimation options
Optional
stateOverrides?: StateOverrideSetOptional state overrides for simulation
User operation without gas estimates
Gas estimation results including all required gas limits
Internal
Estimates verification and call gas limits from execution results.
The user operation being estimated
The simulation execution result
Object containing gas limits and validity window
Internal
Merges user-provided options with default estimation options.
The EntryPointVersion being used
Optional
options: Partial<EstimateUserOperationGasOptions>Partial options to merge with defaults
Complete estimation options
Internal
Uses binary search to estimate gas limits for deployed accounts.
The user operation to estimate for
Gas limit for the main execution call
Maximum total fee per gas unit
Maximum priority fee per gas unit
Account nonce
Gas overhead for pre-verification operations
Gas limit for the verification phase
Current base fee per gas
Estimation options
Optional
stateOverrides: StateOverrideSetOptional state overrides
Gas estimation results
Gas estimator implementation for Optimism networks. Extends EVMGasEstimator to handle Optimism's specific L1/L2 fee calculations.
Example