Socket
Book a DemoInstallSign in
Socket

abi2human

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abi2human

1.0.3
Source
Cargo
Version published
Maintainers
1
Created
Source

abi2human

Publish to crates.io

A zero-dependency Rust implementation for converting Ethereum ABI to human-readable format.

Features

  • ๐Ÿš€ Zero Dependencies: Pure Rust implementation with no external dependencies
  • ๐Ÿ“ Human-Readable Output: Convert complex ABI JSON to readable function signatures
  • ๐ŸŽฏ Multiple Output Formats: JSON array, raw text, or compact JSON
  • ๐Ÿ“ Batch Processing: Convert single files or entire directories
  • ๐Ÿงช Well Tested: Comprehensive test suite included
  • โšก Fast: Optimized Rust performance

Installation

cargo install abi2human

Build from Source

cargo build --release

The binary will be available at ./target/release/abi2human

Usage

Quick ABI Inspection

# Output to stdout in JSON format
abi2human contract.json -o

# Raw text format (one function per line)
abi2human contract.json -or

# Compact JSON (no pretty printing)
abi2human contract.json -o --no-pretty

File Conversion

# Convert and save to a new file
abi2human input.json output.json

# Convert with custom suffix
abi2human input.json -s ".readable"

Batch Directory Processing

# Convert all JSON files in a directory
abi2human ./abis/ -d ./readable/

# Filter with pattern
abi2human ./abis/ -d ./readable/ -p "*.abi.json"

Command Line Options

OPTIONS:
  -o, --stdout     Output to stdout
  -r, --raw        Output raw text format instead of JSON
  -h, --help       Show help message
  -v, --version    Show version
  -q, --quiet      Suppress non-output messages
  -d, --dir        Process directory
  -p, --pattern    Glob pattern for filtering files
  -s, --suffix     Custom suffix for output files (default: ".readable")
  --no-pretty      Disable pretty-printing

Examples

ERC20 Token ABI

Input:

[
  {
    "type": "function",
    "name": "transfer",
    "inputs": [
      {"name": "to", "type": "address"},
      {"name": "amount", "type": "uint256"}
    ],
    "outputs": [{"type": "bool"}],
    "stateMutability": "nonpayable"
  }
]

Output:

function transfer(address to, uint256 amount) returns (bool)

Event Example

Input:

{
  "type": "event",
  "name": "Transfer",
  "inputs": [
    {"name": "from", "type": "address", "indexed": true},
    {"name": "to", "type": "address", "indexed": true},
    {"name": "value", "type": "uint256", "indexed": false}
  ]
}

Output:

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

Supported ABI Types

  • โœ… Functions (view, pure, payable, nonpayable)
  • โœ… Events (with indexed parameters)
  • โœ… Constructors
  • โœ… Fallback functions
  • โœ… Receive functions

Development

Running Tests

cargo test

Building

# Debug build
cargo build

# Release build (optimized)
cargo build --release

Architecture

The project is organized into several modules:

  • abi.rs - ABI data structures and formatting
  • json_parser.rs - Custom JSON parser implementation
  • converter.rs - Core conversion logic
  • file_ops.rs - File and directory operations
  • main.rs - CLI entry point and argument parsing
  • tests.rs - Unit tests

Why Zero Dependencies?

This implementation uses no external crates, providing:

  • Security: No supply chain vulnerabilities from dependencies
  • Simplicity: Easy to audit and understand
  • Portability: Works anywhere Rust compiles
  • Stability: No breaking changes from dependency updates

License

MIT

Contributing

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

FAQs

Package last updated on 06 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.