Pay with Native
This page details the process of paying the gas of user operations (UserOps) using native tokens.
Native token payments are currently restricted to testnets as part of our staging environment. For this functionality, please use staging Gelato Bundler RPC as bundler transport. Checkout testnets listed here.
After reading this page:
You'll know how to pay gas for UserOps using native tokens.
You'll learn about how to use Zerodev Kernel and Safe as an smart account to pay gas .
You'll see some code which will help you send a Non-Sponsored UserOp within minutes.
This method doesn’t require a paymaster, making it a straightforward and direct way to send UserOps while paying with native tokens from your smart account.
Example Code
1. Create an account using createKernelAccount
from @zerodev/sdk
createKernelAccount
from @zerodev/sdk
2. Create an Client using createKernelAccountClient
adding Gelato Bundler RPC
createKernelAccountClient
adding Gelato Bundler RPCWhen using the Gelato Bundler, it's essential to use a specialized gas estimation method when creating the kernelClient.
Gas Config Types
3. Send UserOperation using kernelClient
4. Check UserOp status using Relay API
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 here.
Explore the complete example code that demonstrates how to pay using native tokens while using Gelato Bundler with the ZeroDev Kernel here, as well as how to integrate with a Safe account here.
Last updated