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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sclass

v2.0.5

Published

Solidity to Class Diagram Interpreter

Downloads

21

Readme

S Class

Solidity to Class Diagram Interpreter

Parses Solidity files using @nomicfoundation/slang and generates mermaid markdown, or rendered files (SVG, PNG, PDF, MD, MMD) class diagrams.

Supports Foundry projects, doesn't support Hardhat project (create issue to request hardhat support)

Getting Started

sudo npm i -g sclass
sclass --help

Usage example

sclass src/FlattenedContract.sol --format svg --output FlattenedContract.svg

or with short flags

sclass src/FlattenedContract.sol -f svg

which will output a scheme in svg format with name 'FlattenedContract.svg'.

You can view the FlattenedContract.svg in any web browser or using this preview extension

Configuration

Configuration of diagram generation is evaluated via cli flags

inputContracts

Array of file names without .sol extension of contracts to be included in the diagram, you can put your contracts in /contracts folder and add them here

excludeContracts

If you want to exclude some contracts, you can setup object with following fields:

  • interfaces: boolean - whether to exclude interfaces
  • libraries: boolean - whether to exclude libraries

// TODO: remove collections and replace it with parsing imports

  • collections: array of collection file names to exclude

    ℹ️ Note: Collections are groups of related contracts that can be defined in src/collections. We've already have LayerZero, OpenZeppelin and Stargate collections. You can create your own collections by adding new file in src/collections folder.

  • contracts: array of contract names to exclude

    You don't need to create a new collection, you can just add contract names here

  • exceptions: array of contract names to be included in the diagram despite of being excluded by other fields

excludeFunctions

Object with following fields:

  • regExps: array of regular expressions to exclude functions by name
  • exceptions: array of function names to be included in the diagram despite of being excluded by other fields

disableFunctionParamType

Boolean - whether to disable function parameter type rendering

Also filters out OpenZeppelin, LayerZero and Stargate contracts.

Use cases

  • Contracts high level review
  • Finding unused variables, functions
  • Finding deprecated code blocks

Error handling

If interpreter stumbles across unhandled code variation it will put "empty" to type/name or throw Error with data about unhandled invariant.

Doesn't support nested mappings.

Possible features

  • Enforcing code style and best practices
    • defining comments formatting
    • enforcing internal variable and function name to start with "_"
    • validating requirements existence for address (null address) in functions with address param
  • Generating full inheritance tree for contract
  • Generating other types of Mermaid diagrams from Solidity code (Flowchart, Sequence, Use Case, Entity Relationship)
  • Linking diagram elements to source code to use diagram as a navigation

Other tools by 0xCompose

  • sspec - smart contract specification generator for Foundry