Skip to content

Installation

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

Terminal window
bun add @maxencerb/evs viem
Requirement Version Notes
viem >=2.14.1 Required peer dependency. Execution and result typing go through viem’s readContract inference.
typescript >=5.5 Optional 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.19 Or Bun.

The package has no dependencies of its own: its ABI types (Address, Abi, …) are abitype’s, taken through viem, so they are the exact types viem uses. An abitype Register augmentation in your app (a custom addressType, say) applies to evs and viem alike. Declare it against the abitype viem installs: under npm and bun that is the hoisted copy; under pnpm, add abitype at the version your viem pins.

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 { compile, evscript, t } from '@maxencerb/evs';
const ping = evscript({ name: 'ping', args: [t.uint256] }, (s, x) => {
return s.return({ doubled: 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.