Simulates a ZeroDev user operation and returns a breakdown of expected asset changes, security validation results, and optionally an estimated gas fee — before the operation is submitted to the network. Returns the same result shape asDocumentation Index
Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
simulateEvmTransaction, since user operations are ultimately EVM
transactions. Powered by Blockaid for security validation.
Installation
Usage
Parameters
| Parameter | Type | Description |
|---|---|---|
walletAccount | EvmWalletAccount | The ZeroDev-enabled wallet account |
userOperation | Partial<UserOperation> | The user operation to simulate |
networkId | string | The chain ID (e.g., '1' for Ethereum, '137' for Polygon) |
entryPoint | string | The EntryPoint contract address |
includeFees | boolean (optional) | Whether to include a gas fee estimate. Default: false |
client | DynamicClient (optional) | Only required when using multiple clients |
Returns
Promise<EvmSimulationResult> — an object with the following fields:
| Field | Type | Description |
|---|---|---|
inAssets | AssetDiff[] | Assets the wallet will receive |
outAssets | AssetDiff[] | Assets the wallet will send |
validation | BlockaidValidation (optional) | Security assessment from Blockaid |
validation.result | 'benign' | 'warning' | 'malicious' | Overall security verdict |
validation.description | string (optional) | Human-readable description |
validation.reason | string (optional) | Reason for the verdict |
feeData | EvmTransactionFeeData (optional) | Present only when includeFees: true |
feeData.humanReadableAmount | string | Fee in ETH, formatted for display |
feeData.nativeAmount | bigint | Fee in wei (0n if the operation is sponsored) |
feeData.usdAmount | string (optional) | Fee in USD if price data is available |
feeData.gasEstimate | bigint | Estimated gas units |
priceData | PriceData | Price information for the assets involved |
counterparties | string[] (optional) | Other addresses involved in the operation |
When the operation is eligible for gas sponsorship,
feeData.nativeAmount is 0n — indicating the
user will not pay gas. Use canSponsorUserOperation to check sponsorship eligibility before
simulating.Examples
Token transfer
With gas fee estimation
Security validation
Error handling
Related functions
- simulateEvmTransaction - Simulate a standard EVM transaction
- simulateSolanaTransaction - Simulate a Solana transaction
- sendUserOperation - Send a user operation (single or batch)
- canSponsorUserOperation - Check if a user operation can be sponsored
- estimateUserOperationGas - Estimate gas for a user operation