Skip to main content

Transaction Simulation CLI

About

Transaction Simulation CLI allows you to easily simulate EVM transactions to see their result. CLI version of transaction simulation extension on EXTRA WALLET


License

Licensed under the PolyForm Noncommercial License 1.0.0. Commercial use requires a separate written commercial license agreement from the licensor — contact alex@vir-tec.net.


Key features

  • Supported Networks: Under the hood we are using Tenderly, so any network that is supported there can be used here.
  • Pro Mode: You can use EXTRA WALLET API key if you do not want to create your own account on Tenderly and worry about their credentials

How to run

This is the recommended way for most users.

Requirements

  • Node.js (v22)

Run

npx @extra-wallet/transaction-simulation

This will:

  • download the CLI on demand,
  • start the interactive terminal UI

Option 2: Run locally from the repository (development)

Use this if you want to:

  • inspect the code,
  • modify the CLI,
  • contribute or debug.

Requirements

  • Node.js (v22)
  • pnpm

1. Install dependencies

From the repository root:

pnpm install

2. Build shared code

cd shared/sdk
pnpm build

3. Return to the root of the repository

cd ../..

4. Build the CLI

cd packages/transaction-simulation-cli
pnpm build

5. Run locally

npx transaction-simulation

How to use

The CLI can be run in two modes: interactive and non-interactive

To run the program in interactive mode you just have to follow the instructions of the previous step. In this mode you will be asked for needed inputs step by step.

To run the program in non-interactive mode you have to also specify arguments using flags like this:

npx transaction-simulation --extrawallet-key="..." --input="{...}"

To get information about every argument, you can use help command:

npx transaction-simulation help

Arguments

FlagRequiredDescriptionAliases
inputtrueJSON string of the input expected by Tenderlyi, d, data
extrawallet-keyfalseYour EXTRA WALLET API key. Required when you want to use EXTRA WALLET APIe
accountfalseYour Tenderly account. Required when you do not want to use EXTRA WALLET API
project-keyfalseYour Tenderly project. Required when you do not want to use EXTRA WALLET API
access-key-keyfalseAccess key to your Tenderly project. Required when you do not want to use EXTRA WALLET API
verbosefalseWhether the full result of simulation should be shown or the short one like in interactive mode(only status and url to the simulation result)v
formattedfalseWhether output should be formatted or raw jsonf

Input Format

Input JSON string has to have the following fields:

FieldTypeRequiredExplanation
network_idstringtrueNumberic id as a string of one of the networks supported by Tenderly(1, 137 etc.)
fromstringtrueAddress of the sender of the transaction
tostringtrueAddress of the receiver of the transaction
inputstringfalseCalldata of the transaction. If no calldata specified, defaults to 0x
gasnumberfalseTransaction gas
gas_pricenumberfalseGas price
valuenumberfalseValue of the transaction
simulation_typestringfalseSimulation type. By default eqauls to full. Can also be quick and abi. More about them here

Output

The result will be printed to stdout as a JSON object with two fields:

  • status: boolean value where true means the transaction was successull and false that it failed
  • simulationUrl: URL to full information about simulation on tenderly

In case you are using non-interactive mode and set verbose to true, there will also be a field fullSimulationData with all the information about simulation that tenderly provides. More about the format of that data can be read here

Depending on if formatted was set to true, the result will be printed as a raw or formatted JSON. In interactive mode the result is always formatted.