Installation
Usage
Parameters
| Parameter | Type | Description |
|---|---|---|
walletAccount | EvmWalletAccount | The wallet account initiating the transaction |
transaction | object | The transaction to simulate (see below) |
transaction.from | string | The sender address |
transaction.to | string | The recipient or contract address |
transaction.networkId | string | The chain ID (e.g., '1' for Ethereum mainnet) |
transaction.value | bigint (optional) | Native token amount to send, in wei |
transaction.data | string (optional) | Encoded contract call data |
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 |
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 transaction |
Examples
Simple ETH transfer
Contract call (ERC-20 transfer)
With gas fee estimation
Security validation
Error handling
Related functions
- calculateEvmTransactionFee - Fee estimation only, without asset diffs or security validation
- simulateSolanaTransaction - Simulate a Solana transaction
- simulateZerodevUserOperation - Simulate a ZeroDev user operation
- sendUserOperation - Send an EVM transaction via account abstraction