Skip to main content
Gelato’s Gas Tank is a powerful alternative to traditional onchain paymasters. It acts as a cross-chain gas tank, allowing you to sponsor gas fees across any supported EVM-compatible chain - using just a single balance. Instead of maintaining balances on multiple chains, you only need to deposit funds in one place, and you’re ready to sponsor gas anywhere.
Important: When using Gelato Bundler for Sponsoring Transactions with Gas Tank, both maxFeePerGas and maxPriorityFeePerGas are set to 0. This allows transaction fees to be accurately settled post-execution, rather than upfront via the EntryPoint.

Implementations

npm install @gelatocloud/gasless viem
1

Create an API Key

Check out our How-To Guide for detailed instructions on generating an API key.
2

Create Smart Account

import { createGelatoBundlerClient, sponsored, toGelatoSmartAccount } from '@gelatocloud/gasless';
import { createPublicClient, http } from 'viem';
import { privateKeyToAccount } from "viem/accounts";
import { baseSepolia } from "viem/chains";

const owner = privateKeyToAccount(process.env.PRIVATE_KEY);

const client = createPublicClient({
  chain: baseSepolia,
  transport: http(),
});

const account = await toGelatoSmartAccount({
  client,
  owner,
});
3

Create Bundler Client

const bundler = await createGelatoBundlerClient({
  account,
  apiKey: process.env.GELATO_API_KEY,
  client,
  payment: sponsored(),
  pollingInterval: 100
});
4

Send UserOperation

const hash = await bundler.sendUserOperation({
  calls: [
    {
      data: '0xd09de08a',
      to: '0xE27C1359cf02B49acC6474311Bd79d1f10b1f8De'
    }
  ]
});
console.log(`User operation hash: ${hash}`);

const { receipt } = await bundler.waitForUserOperationReceipt({ hash });
console.log(`Transaction hash: ${receipt.transactionHash}`);