Skip to content

Tevm reference

Overview

Note: this guide is out of date and will be updated soon

Tevm reference docs are autogenerated from their TypeScript types and jsdoc annotations. This guide organizes the generated docs contextually.

All runtime packages are available both as standalone packages (@tevm/actions) or conveniently in a barrel package. tevm. All buildtime packages like the typescript or webpack plugin are similarly available both as a standalone @tevm/ts-plugin and in a barrel package @tevm/bundler

TevmClient api

All clients share the TevmClient api which is how you interact with the EVM. The following reference docs contain it’s api.

Clients

In addition to the TevmClient api above documentation about specific clients exists in following packages

There are also extension clients for viem and ethers

Contracts

A common way of using contract action with tevm is Tevm Contracts and Scripts. They are defined in the @tevm/contracts package

Scripting

Package for creating precompiles for scripting enables JavaScript precompiles to be added to the VM.

Server

  • @tevm/server - Contains utilities to run Tevm as an JSON-RPC http server in Node, Bun, express, and Next.js.

Implementation

The following internal packages contain the majority of the implementation code. All the packages above so far are sufficient for exploring the api. But if you want to dive deeper into implementation source code the following packages can be useful.

@tevm/bundler

To configure your bundler setup navigate to your bundler’s plugins docs @tevm/*-plugin

There is also config documentation below but you are most likely only interested in the CompilerConfig docs.

Bundlers bundle solidity via turning their imports into Contract and Script instances. We already listed this package but for convenience it is below:

Internal packages

There are more internal packages that aren’t listed in this documentation but still have documentation on github in their docs folder.

Runtime packages

  • @tevm/effect - Contains effect related utilities
  • @tevm/state - Contains the custom EVM state implementation for tevm.
  • @tevm/revm - Contains an experimental wasm build of revm. Future versions of Tevm may replace some components with revm.
  • @tevm/schemas - Contains experimental effect schemas for ethereum types.
  • @tevm/viem-effect - Contains an experimental package that strongly types viem errors using effect

Buildtime packages

  • @tevm/base-bundler - Contains the Javascript bundler implementation used internally by all other bundlers
  • @tevm/compiler - Contains the Tevm solidity compiler implementation
  • @tevm/solc - Contains a thin wrapper around solc that adds typescript types.
  • @tevm/ts-plugin - Contains the implementation of of typescript language service plugin. This enables your editor to understand solidity imports.
  • @tevm/lsp - Contains an experimental rewrite of the LSP using volar. This will upgrade the LSP features and give Tevm Svelte and Vue support once ready.
  • @tevm/experimental-solc - Contains experimental package that fetches solc at runtime via an ESM import