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
  • Initial Setup
  • 1. Create Your Gelato Account
  • 2. Create a Relay App
  • 3. Retrieve Your Sponsor API Key
  • 4. Deposit Funds into 1Balance
  • 5. Integrate 1Balance Sponsoring with Gelato Bundler and ZeroDev SDK
  • Example Code
  • 1. Create an account using createKernelAccount from @zerodev/sdk
  • 2. Create an Client using createKernelAccountClient adding Gelato Bundler RPC with sponsorApiKey
  • 3. Send UserOperation using kernelClient
  • 4. Check UserOp status using Relay API
  • Key Benefits of 1Balance
  1. Web3 Services
  2. Account Abstraction
  3. Sponsored UserOps

Using 1Balance

This page details the process of sponsoring user operations (UserOps) using 1Balance.

PreviousSponsored UserOpsNextUsing Zerodev Paymaster

Last updated 1 month ago

After reading this page:

  • You'll know how to Sponsor UserOps using payment method.

  • You'll learn about how to use Zerodev Kernel and Safe Account with 1Balance.

  • You'll see some code which will help you send a Sponsored UserOp within minutes.

Initial Setup

1. Create Your Gelato Account

Sign up on the to establish an account. This account is the foundation for setting up relay tasks and managing gas sponsorships.

2. Create a Relay App

Within your Gelato account, create a relay app on the specific network where you plan to sponsor UserOps. This step enables sponsored transactions on your chosen chain. Checkout supported networks .

3. Retrieve Your Sponsor API Key

4. Deposit Funds into 1Balance

Add funds to your 1Balance account according to your target environment:

  • Mainnets: Deposit USDC.

  • Testnets: Deposit Sepolia ETH.

5. Integrate 1Balance Sponsoring with Gelato Bundler and ZeroDev SDK

Example Code

1. Create an account using createKernelAccount from @zerodev/sdk

const entryPoint = getEntryPoint("0.7");
const kernelVersion = KERNEL_V3_1;

const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
    signer,
    entryPoint,
    kernelVersion,
});

const account = await createKernelAccount(publicClient, {
    plugins: {
      sudo: ecdsaValidator,
    },
    entryPoint,
    kernelVersion
});

2. Create an Client using createKernelAccountClient adding Gelato Bundler RPC with sponsorApiKey

const kernelClient = createKernelAccountClient({
    account,
    chain: baseSepolia,
    bundlerTransport: http(
      `https://api.gelato.digital/bundlers/${chainId}/rpc?sponsorApiKey=${API_KEY}`
    ),
    client: publicClient,
});

3. Send UserOperation using kernelClient

After instantiating the kernelClient, dispatch your UserOperation by explicitly setting both maxFeePerGas and maxPriorityFeePerGas to 0.

console.log("Preparing dummy transaction");
const callData = await kernelClient.account.encodeCalls([
    {
      to: "0x0000000000000000000000000000000000000000",
      value: BigInt(0),
      data: "0x",
    },
  ]);

console.log("Sending user operation...");
const userOpHash = await kernelClient.sendUserOperation({
    callData,
    maxFeePerGas: BigInt(0),
    maxPriorityFeePerGas: BigInt(0),
});
console.log("UserOp taskId:", userOpHash);

4. Check UserOp status using Relay API

Key Benefits of 1Balance

  • Multi-Network Gas Sponsorship Sponsor gas fees on any network supported by Gelato.

  • Effortless Fund Management Deposit USDC on Polygon in one simple step, with additional support for deposits from other networks via Circle CCTP.

  • User-Friendly Interface Easily manage your funds and sponsorship through an intuitive dashboard.

After creating the relay app, navigate to its dashboard to locate your Sponsor API Key. This key links your Gelato setup with 1Balance for gas sponsorship. Learn .

Since 1Balance is deployed on Polygon, you can deposit USDC in one step, and deposits from other networks are supported via Circle CCTP. Learn .

You can directly integrate 1Balance sponsoring with the Gelato Bundler using , or you can integrate the Gelato Bundler with the ZeroDev SDK as given in example code below.

The userOpHash, when using the Gelato Bundler, is equivalent to the Task ID. This Task ID can be easily debugged through the Relay API, providing a streamlined method for troubleshooting and monitoring the status of transactions. Checkout .

Explore the complete example code that demonstrates how to sponsor UserOps using 1Balance with the ZeroDev Kernel , as well as how to integrate with a Safe account .

more
more
Bundler API endpoints
here
here
here
Gelato App
here
1Balance