useEVMTransactionSimulation
Use this hook to simulate EVM transactions and get detailed information about the transaction’s expected outcome, including asset transfers, balance changes, and security validations.Usage
Parameters
ThesimulateEVMTransaction function accepts an object with the following parameters:
| Parameter | Type | Description |
|---|---|---|
| transaction | object | The transaction object containing from, to, data, value, etc. |
| type | string | The transaction type (e.g., ‘SignTransaction’) |
transaction object supports the following fields:
| Field | Type | Description |
|---|---|---|
| from | string | The sender’s address |
| to | string | The recipient’s address |
| data | string | The transaction data (optional) |
| value | bigint | The transaction value in wei (optional) |
| gas | string | The gas limit (optional) |
| gasPrice | string | The gas price in wei (optional) |
chainId is automatically fetched from the wallet connector and should not be included in the parameters.
Response
The simulation returns aSimulateTransactionResponse object containing:
assetTransfers- Array of asset transfers that will occurassetDiffs- Balance changes for each assetblockaidValidation- Security validation resultspriceData- Price information for assets involved
Example
Simulating contract interactions
Simulating Account Abstraction transactions
For ZeroDev wallets and other account abstraction implementations, use thesimulateEVMTransactionAA function:
useSVMTransactionSimulation
Use this hook to simulate Solana (SVM) transactions and validate them before sending to the network.Usage
Parameters
ThesimulateSVMTransaction function accepts an object with the following parameters:
| Parameter | Type | Description |
|---|---|---|
| transaction | Transaction | The Solana Transaction object (not serialized) |
| type | string | The transaction type (e.g., ‘SignTransaction’) |
Response
The simulation returns aSimulateTransactionResponse object containing:
assetTransfers- Array of asset transfers that will occurassetDiffs- Balance changes for each assetblockaidValidation- Security validation resultspriceData- Price information for assets involved