Sponsor gas for your users
Last updated
Last updated
Sponsoring gas for users is one of the most effective ways to enhance the user experience in dApps. With the Gelato Smart Wallet SDK, developers can easily set up sponsored transactions for their applications in just a few simple steps, enabling seamless onboarding and interaction without requiring users to hold native tokens.
Quickly get started by creating a wallet client using createWalletClient
from viem
with local account for your specified network. Checkout supported networks .
To create a Sponsor API Key, visit the Gelato App and navigate to the Relay section. Create a new app, select the required networks, and copy the generated Sponsor API Key.
A Smart Wallet Client serves as an alternative to the standard viem
walletClient, but is purpose-built for managing EOA's as smart wallets instead of traditional EOA (Externally Owned Accounts).
To initialize a Smart Wallet Client, you can use the createGelatoSmartWalletClient
method.
To send sponsored transactions, select Sponsored as the payment method.
You can batch multiple transactions to be sent on-chain at once by adding them to the calls
array.
So far, you’ve learned how to send sponsored EIP-7702 transactions using a smart EOA and kernel wallets. Next, explore different gas payment methods using smart wallets, including Kernel wallets (ERC-4337).
For detailed instructions, click to learn more about creating a Sponsor API Key.
Use wallet: 'kernel'
when creating the Smart Wallet client to ensure ERC-4337 compatibility.
Check out the full implementation of sponsored transactions using Smart Wallets and using Kernel Wallets (ERC-4337) .