Etherspot
These are our V1 docs and will be deprecated soon. Please visit https://etherspot.fyi/introduction to use our new version of the SDK.
  • Welcome to Etherspot
    • Chains, Bridges & DEXes
    • Social Logins
    • Web3 Logins
  • Transaction Kit
    • Introduction
    • Code Sandboxes
    • Quick Start
    • React Hooks
      • useEtherspotAssets()
      • useEtherspotNfts()
      • useEtherspotHistory()
        • getAccountTransactions()
        • getAccountTransaction()
      • useEtherspotTransactions()
        • estimate()
        • send()
      • useEtherspotAddresses()
      • useEtherspotBalances()
    • React Components
      • <EtherspotTransactionKit />
      • <EtherspotBatches />
      • <EtherspotBatch />
      • <EtherspotTransaction />
      • <EtherspotContractTransaction />
      • <EtherspotApprovalTransaction />
      • <EtherspotTokenTransferTransaction />
  • BUIDLER React Component
    • Introduction
    • Installation
    • Integrate React Component
    • Shared Sessions
    • Wallet Connectors
    • Blocks
      • Send
      • Batching Transaction
      • Multicall Transaction
      • Swaps
      • Bridges
      • Custom Contract Interactions
      • Styling
    • Build Your Own Block
      • Cross-chain KLIMA DAO Staking
  • Etherspot SDK Guides
    • Requirements
    • Install Etherspot SDK
    • Bootstrap Etherspot SDK
      • Instantiate Etherspot SDK
    • Events
    • Etherspot Block Explorer
    • Etherspot Playground
    • Social Login using Etherspot SDK
    • Sponsored Transactions
  • Use Cases & Guides
    • Crosschain Streaming
    • Token Swaps
    • Transactions
      • Historical
      • Sending
    • Multi-chain Bridges
      • ERC20 Bridge
      • DAI - xDai Bridge
      • xDai - DAI Bridge
      • Native Token Bridge
    • Custom Contract Interaction
    • Multi-chain Assets
    • Multi-chain Gas Prices
    • Peer-to-Peer Payments
  • Reference
    • Etherspot SDK API Docs
    • Etherspot SDK on Github
    • Etherspot on NPM
    • Etherspot Playground
    • Etherspot Block Explorer
    • Etherspot Architecture
    • EIP-1271
    • Etherspot/Pillar Audit
  • Brand Assets
    • Etherspot Brand Assets
  • Security
    • Security
  • Get in touch
    • ⚒️Discord
    • Twitter
    • Telegram
Powered by GitBook
On this page
  • Getting started
  • Fetching the gas price

Was this helpful?

  1. Use Cases & Guides

Multi-chain Gas Prices

Find out the current gas prices across multiple chains.

PreviousMulti-chain AssetsNextPeer-to-Peer Payments

Last updated 3 years ago

Was this helpful?

Before we continue, please ensure that you have had a look at our Supported Ethereum Chains, followed the steps in and how to . We're assuming that you have completed these steps before going forward.

Getting started

Fetching the gas price of a particular chain or network is performed against the Etherspot SDK instance that your application is using, and the chain or network that the instance of the Etherspot SDK was instantiated with.

Fetching the gas price

To fetch the gas price on a particular chain or network, the following method:getGatewayGasInfo, should be called against your Etherspot SDK instance. For example, to fetch the gas price on mainnet, the getGatewayGasInfo method would need to be called on an Etherspot SDK instance that was instantiated with the networkName of mainnet as shown below:

import { Sdk, NetworkNames, randomPrivateKey } from 'etherspot';

const privateKey = randomPrivateKey();
let etherspotSdkMainnetInstance: Sdk

/**
* If you want to get the gas price of another chain
* or network, simply instantiate the SDK with your
* desired `networkName`.
*/
etherspotSdkMainnetInstance = new Sdk({
  privateKey,
}, {
  networkName: 'mainnet' as NetworkNames,
});

// The following method returns the gas price
etherspotSdkMainnetInstance
  .getGatewayGasInfo();
Install Etherspot SDK
Bootstrap Etherspot SDK