Solidity AST schema, TypeScript type definitions, and utility functions for traversing and querying Solidity compiler ASTs. Current stable version is 0.4.62. Released as needed to support new Solidity versions. Key differentiators: auto-generated types from JSON Schema, type-safe helpers like isNodeType, findAll, astDereferencer, and srcDecoder. Works with Solidity >=0.6.6 (mostly compatible down to 0.5.0).
npm install solidity-astNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows importing types from solidity-ast and using isNodeType and findAll utilities to traverse a Solidity AST.
Use `import { ... } from 'solidity-ast/utils'` for isNodeType, findAll, astDereferencer, srcDecoder.Pin to the latest version of solidity-ast and check compatibility with your Solidity version. The package states it's accurate for >=0.6.6.
Always test after upgrade and consult the changelog or diffs on the NPM package.
Use the types for traversal but be aware that some node types or fields may be missing or inaccurate.
Always pass the complete solc output object (the entire JSON from solc standard JSON input/output).
Change import to: `import { isNodeType } from 'solidity-ast/utils'`Use `import type { SourceUnit } from 'solidity-ast'` in TypeScript, or `const { SourceUnit } = require('solidity-ast')` is incorrect because it's a type-only export.Update to latest version of solidity-ast and ensure your tsconfig includes `node` moduleResolution or `node16`.
Ensure the object has all required fields like `nodeType: 'SourceUnit'`, `nodes`, etc. Use the defined types.
No dependency data recorded yet.