npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@provablehq/veil-codegen

v0.4.1

Published

Generates executable TypeScript contracts from Aleo program ABIs.

Readme

@provablehq/veil-codegen

Generates TypeScript bindings from an Aleo program's ABI, and ships the veil-codegen CLI that drives it.

Reach for it as a package maintainer, not a consumer: point it at a program's abi.json and it emits a .ts module of struct and record interfaces, record and struct decoders (RecordValue → typed interface), per-function input and output types, mapping and storage types, the parsed PROGRAM_ABI constant, and a typed contract factory (read/write/simulate/execute). A package like @provablehq/shield-swap-sdk commits that output and ships it — a consumer installing the package gets the bindings already. You run codegen when the upstream contract drifts (redeploy, a new or renamed entrypoint, struct, or mapping) and the checked-in bindings need to catch up.

Installation

It is a build-time tool, so install it as a dev dependency:

pnpm add -D @provablehq/veil-codegen

Usage

CLI

Two modes. Generate one file directly with --abi + --out:

veil-codegen --abi ./abi/loyalty_token.json --out ./src/generated/loyalty_token.ts

Or drive one or more programs from a config file with --config (this is how @provablehq/shield-swap-sdk wires it — a generate script runs veil-codegen --config codegen/veil.config.json):

veil-codegen --config veil.config.json

Flags:

  • --abi <path> — path to the program's abi.json. Pair with --out.
  • --out <path> — output .ts file. Parent directories are created if missing.
  • --config <path> — path to a config JSON. Defaults to veil.config.json.
  • --core-import <path> — import specifier for @provablehq/veil-core in the emitted file. Defaults to @provablehq/veil-core; on the CLI it overrides the config's coreImport.
  • --help, -h — print usage.

Paths inside a config file resolve relative to the config file's own location, not the working directory.

Config file

{
  "programs": [
    {
      "abi": "./abi/shield_swap_v0_0_2.json",
      "out": "../src/generated/shield_swap.ts"
    }
  ],
  "coreImport": "@provablehq/veil-core"
}
  • programs — one entry per program to generate. Each has an abi path and an out path, both resolved relative to the config file.
  • programs[].programId — optional. Stamps a PROGRAM_ID (and factory target) that differs from the ABI's own program. Set it when the bindings take their shape from one deployment's ABI but must target another, identical-shape deployment. Defaults to the ABI's program.
  • coreImport — optional. Import specifier for @provablehq/veil-core in every emitted file. Defaults to @provablehq/veil-core.

Programmatic API

generate takes an already-parsed ABI and returns the TypeScript source as a string; it writes nothing and touches no network. Parse the ABI with parseAbi from @provablehq/veil-core first, then write the result yourself. This is the path to take when you generate as part of a larger build step rather than from the CLI.

import { readFileSync, writeFileSync } from 'node:fs'
import { parseAbi } from '@provablehq/veil-core'
import { generate } from '@provablehq/veil-codegen'

const abi = parseAbi(JSON.parse(readFileSync('./abi/loyalty_token.json', 'utf-8')))
const source = generate({ abi, coreImport: '@provablehq/veil-core' })
writeFileSync('./src/generated/loyalty_token.ts', source)

generate(options) accepts GenerateOptions:

  • abi — the parsed ABI to generate from.
  • coreImport — optional import specifier for @provablehq/veil-core. Defaults to @provablehq/veil-core.
  • programId — optional override for the emitted PROGRAM_ID, same meaning as the config field above. Defaults to the ABI's program.