Sponsor gas for your users
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.
Steps
1. Import required dependencies
2. Setup Smart Account
You can set up a Smart Account as per your needs. In the case of Gelato
, the Gelato Smart Account address will be the same as your EOA, enabling EIP-7702 features.
When using a Kernel
Account, you have the option to use EIP-7702 and ERC-4337 together. Setting eip7702
parameter to true will make your EOA the sender address. However, if you want to utilize existing Kernel accounts only with ERC-4337 features, set it to false.
For a Safe
Account, it defaults to the ERC-4337 standard. You can either use an already deployed Safe Account or create a new one, while enhancing the experience with Gelato’s best-in-class infrastructure.
3. Setup Wallet Client
4. Create Smart Wallet Client
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.
5. Sending transactions
To send sponsored transactions, select Sponsored as the payment method.
6. Batch multiple transactions
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 gelato, kernel and safe wallets. Next, explore different gas payment methods using all three wallets.
Last updated