Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solidity-ast

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solidity-ast

Solidity AST schema and type definitions

  • 0.4.57
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
62K
decreased by-43.76%
Maintainers
1
Weekly downloads
 
Created

What is solidity-ast?

The solidity-ast package is a tool for parsing and analyzing the Abstract Syntax Tree (AST) of Solidity smart contracts. It provides utilities to traverse and manipulate the AST, which is useful for developers working on Solidity code analysis, refactoring, or tooling.

What are solidity-ast's main functionalities?

Parsing Solidity Source Code

This feature allows you to parse Solidity source code into an Abstract Syntax Tree (AST). The code sample demonstrates how to use the `parse` function to convert a Solidity contract into its AST representation.

const { parse } = require('solidity-ast');
const sourceCode = 'contract MyContract { function myFunction() public {} }';
const ast = parse(sourceCode);

Traversing the AST

This feature provides utilities to traverse the AST. The code sample shows how to use the `findAll` utility to find all function definitions within the AST and log their names.

const { findAll } = require('solidity-ast/utils');
const functions = findAll('FunctionDefinition', ast);
for (const func of functions) {
  console.log(func.name);
}

Other packages similar to solidity-ast

FAQs

Package last updated on 29 Aug 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc