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

@riaskov/iohtee-abi-wrapper

v3.0.3

Published

Generate TypeScript wrapper class for Solidity smart contract ABI

Downloads

59

Readme

@riaskov/iohtee-abi-wrapper

CLI/codegen for generating TypeScript contract wrappers from Solidity ABI artifacts.

Stack

  • Node.js >=22
  • TypeScript 6.0.0-beta
  • Template engine: Eta
  • Backends: viem (default) and ethers (optional)

Install

pnpm add -D @riaskov/iohtee-abi-wrapper

Or global:

pnpm add -g @riaskov/iohtee-abi-wrapper

Tutorial: Solidity -> JSON ABI (Hardhat 3)

1. Create Hardhat 3 project

mkdir my-contracts && cd my-contracts
pnpm init
pnpm add -D hardhat typescript tsx
pnpm hardhat --init

Put your contract in contracts/, for example contracts/Unidirectional.sol.

2. Compile contracts

pnpm hardhat compile

Hardhat writes artifacts to:

artifacts/contracts/<FileName>.sol/<ContractName>.json

Example:

artifacts/contracts/Unidirectional.sol/Unidirectional.json

3. Extract ABI JSON

Hardhat artifact already contains abi field:

{
  "abi": [ ... ]
}

You can pass this artifact directly to iohtee-abi-wrapper.

4. Generate wrappers

From artifact:

iohtee-abi-wrapper -o ./generated -b viem artifacts/contracts/Unidirectional.sol/Unidirectional.json

From pure ABI folder:

iohtee-abi-wrapper -o ./generated -b viem ./abi

CLI usage

iohtee-abi-wrapper [options] <input...>

Examples:

# Generate wrappers with default backend (viem)
iohtee-abi-wrapper -o ./generated ./abi/*

# Generate wrappers from directory
iohtee-abi-wrapper -o ./generated ./abi
iohtee-abi-wrapper -o ./generated ./abi/

# Generate wrappers from multiple explicit files
iohtee-abi-wrapper -o ./generated ./abi/A.json ./abi/B.json

# Explicit viem backend
iohtee-abi-wrapper -o ./generated -b viem ./abi/*

# Ethers backend
iohtee-abi-wrapper -o ./generated -b ethers ./abi/*

# Generate minified wrappers
iohtee-abi-wrapper -o ./generated -m ./abi/*

# Generate docs
iohtee-abi-wrapper -o ./generated -d ./docs ./abi/*

Options:

  • -o, --output output directory (required)
  • -b, --backend viem | ethers (default: viem)
  • -m, --minify generate minified js wrapper
  • -d, --docs docs output directory

Package scripts

pnpm --filter @riaskov/iohtee-abi-wrapper run lint
pnpm --filter @riaskov/iohtee-abi-wrapper run test
pnpm --filter @riaskov/iohtee-abi-wrapper run build

Output

For Unidirectional.json, generator emits UnidirectionalContract wrapper and typings.

Usage examples

Unidirectional + viem backend

// generated with:
// iohtee-abi-wrapper -o ./generated-viem -b viem ./abi/Unidirectional.json
import {
  UnidirectionalContract,
  UnidirectionalEventName,
} from './generated-viem/UnidirectionalContract.js'

const contract = new UnidirectionalContract(
  '0x1111111111111111111111111111111111111111',
  {
    httpRpcUrl: 'http://127.0.0.1:8545',
    networkId: 31337,
    mnemonic: 'test test test test test test test test test test test junk',
    hdPath: "m/44'/60'/0'/0/0",
  },
)

const channelId =
  '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',

// view call
const canDeposit = await contract.canDeposit(
  channelId,
  '0x2222222222222222222222222222222222222222',
)
console.log('canDeposit:', canDeposit)

// state-changing call
const receipt = await contract.deposit(channelId, { value: 1_000_000_000_000n })
const hasDepositEvent = UnidirectionalContract.hasEvent(
  receipt,
  UnidirectionalEventName.DidDeposit,
)
console.log('DidDeposit emitted:', hasDepositEvent)

Unidirectional + ethers backend

// generated with:
// iohtee-abi-wrapper -o ./generated-ethers -b ethers ./abi/Unidirectional.json
import {
  UnidirectionalContract,
  UnidirectionalEventName,
} from './generated-ethers/UnidirectionalContract.js'

const contract = new UnidirectionalContract(
  '0x1111111111111111111111111111111111111111',
  {
    httpRpcUrl: 'http://127.0.0.1:8545',
    networkId: 31337,
    mnemonic: 'test test test test test test test test test test test junk',
    hdPath: "m/44'/60'/0'/0/0",
  },
)

const channelId =
  '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',

// view call
const digest = await contract.paymentDigest(channelId, 10n)
console.log('paymentDigest:', digest)

// state-changing call
const receipt = await contract.deposit(channelId, { value: 1_000_000_000_000n })
const hasDepositEvent = UnidirectionalContract.hasEvent(
  receipt,
  UnidirectionalEventName.DidDeposit,
)
console.log('DidDeposit emitted:', hasDepositEvent)