Skip to main content
Version: SDK V4 (latest)

Integration

This guide focuses on the code to integrate the entry point gas estimations package.

Installation

First, install the required packages for initializing the gas estimator client


npm i entry-point-gas-estimations

Integration

import { createGasEstimator } from "entry-point-gas-estimations";

// Creating a general gas estimator client
const gasEstimator = createGasEstimator({
rpcUrl,
});

// L2s have a different way of calculating the preVerificationGas
// which requires creating network-specific gas estimator clients

// Optimism Stack Networks
const optimismGasEstimator = createOptimismGasEstimator({
rpcUrl,
});

// Arbitrum Networks
const arbitrumGasEstimator = createArbitrumGasEstimator({
rpcUrl,
});

// Mantle Networks
const mantleGasEstimator = createMantleGasEstimator({
rpcUrl,
});

// Scroll Networks
const scrollGasEstimator = createScrollGasEstimator({
rpcUrl,
});

Parameters

  • rpcUrl(string, required): RPC Url of the network
  • entryPointAddress(string): optional entry point if it is different than 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789

returns

  • gasEstimator(Promise<GasEstimator>): gas estimator instance

Was this page helpful?