ZeroDev v0.9.0 Migration Guide
Version 0.9.0 introduces a unified UserOperation API that replaces the previous transaction-based APIs. The new API supports both single and batch transactions with a consistent interface.Breaking Changes
The following functions have been removed:estimateTransactionGas→ UseestimateUserOperationGascanSponsorTransaction→ UsecanSponsorUserOperationprepareUserOperationWithKernelClient→ UsesendUserOperation
New Features
- Batch Transaction Support: Execute multiple operations atomically in a single UserOperation
- Unified API: Consistent interface for single and batch transactions
- Better Error Handling: More granular error types and messages
Migration Examples
Checking Sponsorship
Before (v0.8.x):- Renamed from
canSponsorTransactiontocanSponsorUserOperation transactionparameter →calls(array)- Single transaction now wrapped in an array
Estimating Gas
Before (v0.8.x):- Renamed from
estimateTransactionGastoestimateUserOperationGas transactionparameter →calls(array)- Single transaction now wrapped in an array
Sending Transactions
Before (v0.8.x):- New unified
sendUserOperationfunction - Simplifies the send flow - no need for manual kernel client preparation
- Returns complete receipt with
userOpHashandsuccessstatus
Batch Transaction Support
The new API’s main advantage is native batch transaction support:- Atomicity: All operations succeed or all fail together
- Cost Efficiency: Single validation per batch reduces gas fees
- Better UX: Users approve once for multiple operations
- Composability: Enable complex multi-step workflows (e.g., approve + swap)
Migration Checklist
- Replace
canSponsorTransactionwithcanSponsorUserOperation - Replace
estimateTransactionGaswithestimateUserOperationGas - Replace manual UserOperation preparation with
sendUserOperation - Update
transactionparameter tocallsarray - Wrap single transactions in an array:
calls: [transaction] - Update error handling for new error types
- Test all transaction flows thoroughly
- Consider using batch transactions for multi-step workflows