Registry / devops / anvil-sol

anvil-sol

JSON →
library0.3.4jsnpmunverified

Anvil is a CLI tool that transpiles Anchor-based Solana programs to Pinocchio, native (solana-program), or Quasar Rust dialects, producing cargo-buildable projects from a single typed IR. Current stable version is 0.3.4, released with a weekly cadence. Key differentiators: deterministic emit with a validator, portability linting, CU benchmarking, and a migration safety analysis tool. Requires Bun >=1.0.0 and depends on litesvm, @solana/web3.js, and @noble/hashes as peer dependencies. Supports three targets with regression gates (21+ MUST_PASS for pinocchio and native).

npm install anvil-sol
INSTALL
IMPORT
SIG · ANVIL-SOL
A
anvil-sol
devopsjavascriptv0.3.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import anvil from 'anvil-sol';
const anvil = require('anvil-sol');
ESM-only; ESM support only from v0.3+.
compile
import { compile } from 'anvil-sol';
import { compile } from 'anvil-sol/compile';
Named export; subpath imports not supported.
lint
import { lint } from 'anvil-sol';
const { lint } = await import('anvil-sol');
Also top-level named export.

Shows installation, transpilation to Pinocchio, parsing to IR, portability linting, CU benchmarking, snapshotting, diffing, and migration analysis.

// Install globally bun install -g anvil-sol # Transpile an Anchor program to Pinocchio anvil compile program.rs --target pinocchio --output ./out cd ./out && cargo build # Parse to IR anvil parse program.rs --json # Portability lint anvil lint program.rs --target pinocchio # Benchmark CU anvil bench program.rs # Snapshot CUs anvil snapshot program.rs # Diff IRs anvil diff old.ir.json new.ir.json # Migration analysis anvil migrate diff old-layout.json new-layout.json anvil migrate codegen old-layout.json new-layout.json --output migration.rs
anvil --version
Debug
Known issues
breakingRequires Bun >=1.0.0 — Node.js and npm are not supported.
fix
Install Bun from https://bun.sh before using anvil-sol.
affects: >=0.0.0
breakingESM-only module — CommonJS require() will fail.
fix
Use import syntax or run via Bun which supports ESM.
affects: >=0.3.0
gotchaQuasar target is experimental; cargo-build may fail and some CPIs emit TODO stubs.
fix
Use pinocchio or native targets for production.
affects: >=0.0.0
deprecatedThe `anvil migrate diff` command is new in 0.3; older versions don't have it.
fix
Upgrade to >=0.3.0 for migration support.
affects: <0.3.0
Errors
Common errors & fixes
bun: command not found
Bun is not installed or not in PATH.
fix
Run 'curl -fsSL https://bun.sh/install | bash' to install Bun.
Error: Cannot find module 'anvil-sol'
Package not installed or wrong import path.
fix
Install globally with 'bun install -g anvil-sol' or run with 'bunx anvil-sol'.
TypeError: anvil is not a function
Using default import incorrectly; named exports are required.
fix
Use named imports like '{ compile }' instead of default import.
Upgrade
Version history
0.3.4latest on npm
Audit
Dependencies
bunrequiredRequired runtime; must be >=1.0.0 as per engines.
litesvmoptionalUsed for local Solana VM execution in tests/benchmarks.
@solana/web3.jsrequiredRequired for Solana RPC interaction and account layout representation.
@noble/hashesrequiredUsed for hashing operations in the transpiler.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
anvil-sol — npm install anvil-sol · libregistry