Skip to content
Logo

Cartesi TypeScript libraries

A set of libraries for building Cartesi applications in TypeScript — from the code that runs inside the Cartesi Machine to the frontend that talks to a Cartesi node.

Pick the layer you are working on:

Frontend

Talk to a Cartesi node and to the rollups contracts on the base layer.

@cartesi/client

A viem extension. L2 public actions for the Cartesi Rollups node JSON-RPC API — read inputs, outputs, reports and epochs — plus the typed ABIs and deployment addresses for L1 contract interactions.

Start with the introduction, or jump to getInput · listOutputs · waitForInput.

@cartesi/react

The same L2 actions as React hooks, built on TanStack Query: useInput, useOutputs, useWaitForInput and one per action.

Start with the introduction.

@cartesi/rpc

The typed JSON-RPC client underneath @cartesi/client. Use it directly when you want the raw cartesi_* methods and wire types rather than viem.

Start with the introduction, or see createClient.

Bindings

Native addons for the Cartesi Machine. Prebuilt binaries ship for linux and macOS, so there is nothing to compile.

@cartesi/rollup

Bindings for libcmt, the guest rollup library, for applications running inside a Cartesi Machine: handle advance and inspect requests and emit vouchers, notices, reports and exceptions, without the rollup HTTP server. The same code runs on your development host against a mock.

Start with Getting Started, then Handling Requests.

@cartesi/machine

Bindings for the Cartesi Machine emulator itself, for code running outside the machine: create, run, snapshot and inspect machines in-process or out-of-process over JSON-RPC, and drive a rollups machine through advance and inspect requests.

Start with the introduction, then Local Machine.

Encoding

@cartesi/codec

Isomorphic encoding and decoding of the blobs that cross the machine boundary: inputs (EvmAdvance), outputs (Notice, Voucher, DelegateCallVoucher) and portal deposits. Browser and Node.js, depends only on viem.

Start with the introduction.

Codegen

@cartesi/wagmi-plugin

A Wagmi CLI plugin that generates ABIs and deployment addresses for the Cartesi Rollups contracts straight from an official release.

Start with the introduction.