Gelato
  • Introduction
    • Gelato, The Web3 Cloud Platform
  • Rollup As A Service
    • Introduction
    • Rollup Stacks
      • Arbitrum Orbit
        • Run a Full Orbit Node
      • OP Stack
        • Run OP Node
    • Deploy your Rollup
    • Customization
      • Data Availability
        • Celestia
        • Avail
        • Eigen DA
      • Custom Gas Token
      • Marketplace
        • Gelato Services
        • Data Indexers
        • Block Explorers
        • Oracles
        • Bridges
        • Account Abstraction
        • On & Off-ramp
        • Community
        • Identity & KYC
        • Others
      • Verifier Node Package
    • Public Testnet
  • RPC Nodes
    • Introduction
    • Compute Units
    • Using RPC Nodes
    • Supported Networks
    • Pricing and Plans
    • FAQ
  • Web3 Services
    • Web3 Functions
      • Understanding Web3 Functions
        • Trigger Types
        • Typescript Function
        • Solidity Function
        • Automated Transactions
      • Security Considerations
      • Template & Use Cases
      • Quick Start
        • Writing Typescript Functions
          • Event Trigger
          • Private Typescript Functions
          • Callbacks
        • Test, Deploy & Run Typescript functions
        • Writing Solidity Functions
        • Test, Deploy & Run Solidity Functions
        • Initiate an Automated Transaction
      • Create a Web3 Function Task
        • Using the UI
        • Using the Safe App
        • Using a Smart Contract
        • Using the Automate SDK
      • Analytics & Monitoring
      • Supported Networks
      • Subscription & Payments
      • Legacy Automate Migration Guide
    • Relay
      • What is Relaying?
      • Security Considerations
        • ERC-2771 Delegatecall Vulnerability
      • Templates
      • Quick Start
        • Sponsored Calls
        • Non-Sponsored Calls
      • ERC-2771 (recommended)
        • SponsoredCallERC2771
        • CallWithSyncFeeERC2771
          • Relay Context Contracts ERC2771
      • Non-ERC-2771
        • SponsoredCall
        • CallWithSyncFee
          • Relay Context Contracts
      • Relay API
      • Gelato's Fee Oracle
      • Tracking your Relay Request
      • Supported Networks
      • Subscriptions and Payments
        • 1Balance & Relay
        • SyncFee Payment Tokens
        • Relay Pricing
      • ERC2771 Migration Guide
    • VRF
      • Understanding VRF
      • How does Gelato VRF Work?
      • Security Considerations
      • Template
      • Quick Start
      • Create a VRF Task
        • Create a Fallback VRF
        • Migrating from Chainlink VRF
      • Supported Networks
      • Pricing & Rate Limits
    • Oracles
      • Understanding Gelato Oracles
      • Quick Start
      • Data Providers
        • Stork
        • Choas Labs
      • Migrating from Chainlink Oracles
      • Available Price Feeds
      • Supported Networks
      • Pricing & Rate Limits
    • Account Abstraction
      • Understanding ERC4337
      • Introduction to Gelato Bundler
      • Templates & Examples
      • Quick Start
      • Sponsored UserOps
        • Using 1Balance
        • Using Zerodev Paymaster
      • Non-Sponsored UserOps
        • Pay with Native
        • Pay with ERC20
      • Supported Networks
      • Bundler API Endpoints
        • eth_sendUserOperation
        • eth_estimateUserOperationGas
        • eth_getUserOperationByHash
        • eth_getUserOperationReceipt
        • eth_supportedEntryPoints
        • eth_maxPriorityFeePerGas
        • eth_chainId
    • 1Balance
      • 1Balance Alerts
      • Subscription Plans
      • Subscription Notifications
      • USDC Addresses
    • AI Agents
    • Teams
  • GELATO DAO
    • DAO & Token (GEL)
    • GEL Token Contracts
    • Governance Process
  • Social Media
Powered by GitBook
On this page
  • Querying via the SDK
  • SDK method: isOracleActive
  • SDK method: getPaymentTokens
  • SDK method: getEstimatedFee
  • Querying via the API
  1. Web3 Services
  2. Relay

Gelato's Fee Oracle

How to get a quote for your relay fee before sending the request

After reading this page:

  • You'll understand how to query the fee oracle using either the SDK or the API directly and which methods/endpoints are available.

  • You'll learn the difference between different fee modalities and trade offs: for example, allowing your user to sign off on a maximum fee they are willing to pay helping account for gas volatility, or allowing them to sign off on the exact fee but with a higher risk of non-execution.

You can query our fee oracle before the relay request to get an overall estimated fee (gas costs + Gelato fee) for your relay request.

Querying via the SDK

SDK method: isOracleActive

const isOracleActive = async (chainId: bigint): Promise<boolean>

Arguments:

  • chainId: the chain ID of the network on which to check if the fee oracle is active.

Return Object:

  • true/false: depending on the status of the fee oracle on the requested network.

SDK method: getPaymentTokens

const getPaymentTokens = async (chainId: bigint): Promise<string[]>

Arguments:

  • chainId: the chain ID of the network where you want to check if the fee oracle is active there.

Return Object:

  • An array of strings listing all accepted payment tokens on the requested network.

SDK method: getEstimatedFee

getEstimatedFee = (
  chainId: bigint,
  paymentToken: string,
  gasLimit: bigint,
  isHighPriority: boolean,
  gasLimitL1?: bigint
): Promise<bigint>

Arguments:

  • chainId: the chain ID of the network where you want to check if the fee oracle is active there.

  • paymentToken: the address of the token you would like to pay in.

  • gasLimit: a custom gas limit for your transaction, please remember to add an overhead for Gelato Relay's contract calls and security checks.

Return Object

  • The value of your estimated fee, including gas costs + gelato fee on top.

Querying via the API

PreviousRelay APINextTracking your Relay Request

Last updated 1 month ago

isHighPriority: for increasing your priority gas fee. If true, you will incur higher costs but have a higher certainty of block inclusion.

gasLimitL1: gas limit for the which is required to properly estimate fees on OP Stack chains, e.g. Optimism, Base, Zora. Can be omitted on all other chains.

NOTE: please be aware that if your relayed transaction incurs gas refunds, for example, for clearing out storage slots, this is not known beforehand. These refunds can only be known after the fact, from the transaction receipts. This means that the fee oracle will give you a price which does not include the gas refunds, so it may be higher than you think. This is due to how the EVM works, and the initial gas allocated for execution should still be the total amount before refunds, otherwise you will get an 'Out of gas' error. See for more info.

Please see the available endpoints on the page.

EIP-1559 flag
L1 data fee
here
API