Skip to content

Installation

viem is a required peer dependency — install it alongside the package:

Terminal window
bun add @maxencerb/evs viem
RequirementVersionNotes
viem>=2.14.1Required peer dependency. Execution and result typing go through viem’s readContract inference.
typescript>=5.5Optional peer dependency — the runtime works without it, but the typed surface (literal-typed ABI, Expr inference) is the point of the library. strict mode is required.
Node.js>=20.19Or Bun.

The package ships as ESM only ("type": "module"): there is no CommonJS build, so use import, not require. Everything is exported from the single entry point @maxencerb/evs — the exports map exposes no module subpaths, so deep imports like @maxencerb/evs/core do not resolve.

This compiles a one-argument script to bytecode without touching a network — if it typechecks and runs, you are set:

import { arg, compile, evscript, t } from '@maxencerb/evs';
const ping = evscript({ name: 'ping', args: [arg('x', t.uint256)] }, (s) => {
return s.return({ doubled: s.args.x.mul(2n) });
});
export const artifact = compile(ping);
// artifact.runtimeBytecode — EVM bytecode, ready for eth_call

Continue with the quick start to execute a script against a real node.