Skip to content

danilych/solidity-errors-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solidity-errors-decoder

A CLI tool for scanning Solidity files and decoding error selectors.

Installation

Global Installation

npm install -g solidity-errors-decoder

Local Installation

npm install solidity-errors-decoder

Usage

Decode an Error Selector

# Using the globally installed command
sol-errors-decoder 0x82b42900

# Using npx
npx solidity-errors-decoder 0x82b42900

# Using bun
bun solidity-errors-decoder 0x82b42900

Scan a Specific Directory

By default, the tool scans the current directory. You can specify a different directory:

sol-errors-decoder 0x82b42900 --directory /path/to/solidity/project
# OR
sol-errors-decoder 0x82b42900 -d /path/to/solidity/project

List All Errors

To list all errors found in the project without decoding a specific selector:

sol-errors-decoder --list
# OR
sol-errors-decoder -l

Development

This project was created using Bun:

# Install dependencies
bun install

# Run the tool
bun index.ts

# Build for distribution
bun run build

How It Works

The tool:

  1. Scans the specified directory for .sol files
  2. Extracts all custom errors using regex pattern matching
  3. Calculates the selector for each error (first 4 bytes of keccak256 hash)
  4. When given a selector, finds and displays the matching error

License

MIT

About

CLI tool to decode Solidity custom error selectors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published