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

solidity-abi-exporter

v1.0.4

Published

CLI tool to export human readable ABI directly from Solidity source code

Readme

Solidity ABI Exporter

A CLI tool that extracts human-readable ABI (Application Binary Interface) directly from Solidity source code without requiring compilation.

Features

  • Direct Source Parsing: Extracts ABI information directly from .sol files
  • No Compilation Required: Works without Hardhat, Truffle, or any build process
  • Multiple Output Formats: Supports Markdown, plain text, and JSON formats
  • Comprehensive ABI Coverage: Extracts functions, events, errors, modifiers, and state variables
  • CLI Interface: Easy-to-use command-line interface
  • Batch Processing: Process entire directories of Solidity files
  • Smart Contract Types: Supports contracts, interfaces, and libraries

Installation

Global Installation (Recommended)

npm install -g solidity-abi-exporter

Local Installation

npm install solidity-abi-exporter

From Source

git clone https://github.com/huaigu/hardhat-human-readable-abi-exporter.git
cd hardhat-human-readable-abi-exporter
npm install
npm link  # For global usage

Usage

Basic Usage

# Export ABI from contracts directory to output directory
sol-abi-export ./contracts ./abi-output

# Specify output format
sol-abi-export ./contracts ./abi-output --format markdown
sol-abi-export ./contracts ./abi-output --format text
sol-abi-export ./contracts ./abi-output --format json

Advanced Options

# Process subdirectories recursively
sol-abi-export ./contracts ./abi-output --recursive

# Verbose output for debugging
sol-abi-export ./contracts ./abi-output --verbose

# Include additional elements
sol-abi-export ./contracts ./abi-output --include-modifiers

# Customize what to include
sol-abi-export ./contracts ./abi-output \
  --include-events \
  --include-errors \
  --include-modifiers

CLI Options

| Option | Description | Default | |--------|-------------|---------| | --format, -f | Output format (markdown|text|json) | markdown | | --recursive, -r | Process subdirectories recursively | false | | --verbose, -v | Verbose output | false | | --include-events | Include events in output | true | | --include-errors | Include custom errors in output | true | | --include-modifiers | Include modifiers in output | false |

Output Examples

Markdown Format

# ERC20Token

**Type:** Contract
**Inherits:** IERC20, Ownable

## Constructor

### constructor

```solidity
function constructor(string name, string symbol, uint256 totalSupply) public

Parameters:

  • name (string)
  • symbol (string)
  • totalSupply (uint256)

View Functions

balanceOf

function balanceOf(address account) public view returns (uint256)

Parameters:

  • account (address)

Returns:

  • _return0 (uint256)

Events

Transfer

event Transfer(indexed address from, indexed address to, uint256 value)

Parameters:

  • from (address) (indexed)
  • to (address) (indexed)
  • value (uint256)

### Text Format

ERC20Token (contract)

CONSTRUCTOR: function constructor(string name, string symbol, uint256 totalSupply) public

FUNCTIONS: function balanceOf(address account) public view returns (uint256) function transfer(address to, uint256 amount) public returns (bool)

EVENTS: event Transfer(indexed address from, indexed address to, uint256 value)


### JSON Format

Standard ABI JSON format compatible with ethers.js, web3.js, and other tools.

## Programmatic Usage

You can also use this tool programmatically in your Node.js applications:

```javascript
const { exportABIFromDirectory, SolidityParser, ABIExtractor } = require('solidity-abi-exporter');

// Export from directory
const results = await exportABIFromDirectory('./contracts', './output', {
  format: 'markdown',
  recursive: true,
  includeEvents: true,
  includeErrors: true,
});

console.log(`Processed ${results.processedFiles} files`);

// Parse individual file
const parser = new SolidityParser();
const extractor = new ABIExtractor();

const sourceCode = fs.readFileSync('./Contract.sol', 'utf8');
const ast = parser.parse(sourceCode);
const contracts = extractor.extractContracts(ast);

Supported Solidity Features

  • ✅ Functions (public, external, internal, private)
  • ✅ State variables (public getters)
  • ✅ Events (including indexed parameters)
  • ✅ Custom errors
  • ✅ Modifiers
  • ✅ Constructor
  • ✅ Receive and fallback functions
  • ✅ Inheritance
  • ✅ Complex types (mappings, arrays, structs)
  • ✅ Function overloading
  • ✅ All state mutability types (pure, view, payable, nonpayable)

Requirements

  • Node.js >= 14.0.0
  • Solidity files with valid syntax

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Changelog

v1.0.4

  • Complete rewrite as standalone CLI tool
  • Direct Solidity source parsing
  • Multiple output formats
  • Comprehensive ABI extraction
  • No compilation dependencies