Prerequisites
- Create a Zerodev account and projects for each network you want to support, as well as a gas policy for each one. Make sure you use the V1 dashboard to configure your project.
- Visit the Sponsor Gas section of the dashboard, toggle on Zerodev and add your project IDs.
1. Add the ZeroDev extension
Install the package and add the extension when creating your client. You need the EVM extension as well:2. Send a sponsored transaction
UsesendUserOperation with a wallet account. Sponsorship is on by default when you use a wallet account, so your users don’t pay gas:
sendUserOperation with a wallet account.
Optional: check if an operation can be sponsored
To show different UI when sponsorship isn’t available (e.g. unsupported network or paymaster limit), usecanSponsorUserOperation before sending:
When sponsorship is used
| Scenario | Sponsored? |
|---|---|
sendUserOperation with walletAccount (default) | Yes (withSponsorship: true) |
sendUserOperation with withSponsorship: false | No — user pays gas |
sendUserOperation with kernelClient only | Depends on how the kernel client was created |
More
- sendUserOperation — Full API, batching, and options
- Adding ZeroDev Extension — Extension setup only
- createKernelClientForWalletAccount — When you need a kernel client for advanced flows
- isGasSponsorshipError — Handling sponsorship errors