TevmActionsApi
TevmActionsApi:
object
The actions api is the high level API for interacting with a Tevm client similar to viem actions
See
https://tevm.sh/learn/actions/
Type declaration
call
call:
CallHandler
Executes a call against the VM. It is similar to eth_call
but has more
options for controlling the execution environment
By default it does not modify the state after the call is complete but this can be configured.
Example
contract
contract:
ContractHandler
Executes a contract call against the VM. It is similar to eth_call
but has more
options for controlling the execution environment along with a typesafe API
for creating the call via the contract abi.
The contract must already be deployed. Otherwise see script
which executes calls
against undeployed contracts
Example
deploy
deploy:
DeployHandler
Creates a transaction to deploys a contract to tevm
dumpState
dumpState:
DumpStateHandler
Dumps the current state of the VM into a JSON-seralizable object
State can be dumped as follows
Examples
And then loaded as follows
getAccount
getAccount:
GetAccountHandler
Gets the state of a specific ethereum address
Example
loadState
loadState:
LoadStateHandler
Loads a previously dumped state into the VM
State can be dumped as follows
Examples
And then loaded as follows
mine
mine:
MineHandler
Mines 1 or more blocks
script
script:
ScriptHandler
Executes scripts against the Tevm EVM. By default the script is sandboxed
and the state is reset after each execution unless the persist
option is set
to true.
Examples
Contract handlers provide a more ergonomic way to execute scripts
setAccount
setAccount:
SetAccountHandler
Sets the state of a specific ethereum address