Skip to content

@tevm/actions

The @tevm/actions package provides a comprehensive set of actions for interacting with the Tevm client. It includes both standard Ethereum JSON-RPC methods and Tevm-specific functionality.

Generated API Documentation: View the full API documentation in the evmts/tevm-monorepo/packages/actions/docs folder.

Installation

npm install @tevm/actions

Overview

The @tevm/actions package provides handlers for:

  • Executing EVM calls and contract interactions
  • Managing blockchain state and accounts
  • Standard Ethereum JSON-RPC methods
  • Testing and development utilities (Anvil-compatible)
  • Debugging and tracing functionality

API Reference

Error Classes

Core Types

  • Address - Ethereum address type
  • Abi - Contract ABI type
  • Block - Ethereum block type
  • BlockTag - Block reference tag (latest, earliest, etc)

Base Actions

Call Actions

Contract Actions

Deploy Actions

Validation Functions

JSON-RPC Procedures

Internal Utilities

Ethereum JSON-RPC Actions

Account & Network

State Reading

Block Operations

Anvil (Testing & Development) Actions

State Manipulation

Mining & Chain Control

Debug Actions

Usage Examples

Basic Call Example

import { createTevmNode } from 'tevm/node'
import { callHandler } from '@tevm/actions'
 
const client = createTevmNode()
const call = callHandler(client)
 
const result = await call({
  to: '0x123...',
  data: '0x456...',
  value: 1000n
})

Contract Interaction Example

import { contractHandler } from '@tevm/actions'
 
const contract = contractHandler(client)
const result = await contract({
  to: '0x123...',
  abi: [...],
  function: 'transfer',
  args: ['0x456...', 1000n]
})

Deployment Example

import { deployHandler } from '@tevm/actions'
 
const deploy = deployHandler(client)
const result = await deploy({
  bytecode: '0x...',
  abi: [...],
  args: ['constructor arg']
})

JSON-RPC Example

import { ethCallHandler } from '@tevm/actions'
 
const ethCall = ethCallHandler(client)
const result = await ethCall({
  to: '0x123...',
  data: '0x456...'
})

Error Handling

All actions support a throwOnFail parameter to control error handling:

const result = await call({
  to: '0x123...',
  throwOnFail: false // Return errors in result instead of throwing
})

See Also