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

sol-classer

v2.0.0

Published

Classer is a CLI tool that automatically generates strongly-typed TypeScript or vanilla JavaScript classes from Ethereum ABI JSON/JS/TS files. It streamlines contract interaction by providing:

Readme

Classer: ABI to TypeScript/JavaScript Class Generator

Classer is a CLI tool that automatically generates strongly-typed TypeScript or vanilla JavaScript classes from Ethereum ABI JSON/JS/TS files. It streamlines contract interaction by providing:

  • Strict Typing: TypeScript types for all function inputs and outputs (optional).
  • Read/Write Separation: Clear distinction between view functions and state-modifying transactions.
  • Provider Flexibility: Support for both RPC (server-side) and window.ethereum (browser).
  • ERC20 Helpers: Automatic injection of getBalance and transferTokens helpers for ERC20 contracts.
  • Robustness: Automatic contract initialization, setSigner helpers, and error handling wrapping.
  • Ethers.js v6 Integration: Built on top of the latest Ethers.js for robust interaction.

Installation

To use it, you can install it globally or use npx:

npm install -g sol-classer
# OR
npx sol-classer [options]

Usage

Basic usage:

sol-classer \
  --abi <path_to_abi> \
  --name <ClassName> \
  --address <ContractAddress> \
  [options]

Options

  • -a, --abi <path>: Required. Path to the ABI file (.json, .js, .ts).
  • -n, --name <name>: Required. Name of the class to generate.
  • -x, --address <address>: Required. The default contract address.
  • -o, --output <path>: Optional. Output file path. Defaults to <ClassName>.[ts|js].
  • --provider <type>: Optional. 'rpc' (default) or 'window'.
  • --lang <language>: Optional. 'ts' (default) or 'js'.
  • --rpc <variable>: Optional. Env var for RPC URL (only for RPC provider). Defaults to NEXT_PUBLIC_RPC.

Examples

1. Standard TypeScript Class (RPC Provider)

sol-classer \
  --abi test/samples/ERC20.json \
  --name MyToken \
  --address 0x123... \
  --provider rpc \
  --lang ts

2. Browser/Frontend Class (Window Provider) This generates a class that connects to window.ethereum and handles wallet connection.

sol-classer \
  --abi ABI/ABI.js \
  --name FrontendToken \
  --address 0x456... \
  --provider window

Usage in Frontend:

const token = new FrontendToken();
// Auto-initializes on first call, or call explicitly
await token.setSigner(); 
await token.transfer("0xUser", "10"); 

3. JavaScript Class (No Types)

sol-classer \
  --abi test/samples/ERC20.json \
  --name LegacyToken \
  --address 0x789... \
  --lang js

Generated Code Features

  • Automatic Initialization: All methods call initializeContract() internally to ensure provider/signer availability.
  • Error Handling: All contract calls are wrapped in try-catch blocks with informative error logging.
  • Extensible: The generated class can be easily extended or modified.
  • Isomorphic: Works in Node.js (RPC) and Browser (Window) environments.
  • Zero Config: Just pass the ABI and you are good to go.