{"id":15674029,"url":"https://github.com/tintinweb/solidity-workspace","last_synced_at":"2025-04-28T17:04:02.987Z","repository":{"id":65497448,"uuid":"350357874","full_name":"tintinweb/solidity-workspace","owner":"tintinweb","description":"A simple workspace based interface to the solidity-parser and objectified Abstract Syntax Tree","archived":false,"fork":false,"pushed_at":"2024-05-05T12:56:43.000Z","size":171,"stargazers_count":16,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-16T20:15:13.679Z","etag":null,"topics":["solidity","solidity-parser"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/solidity-workspace","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tintinweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-22T13:40:26.000Z","updated_at":"2024-12-19T03:03:24.000Z","dependencies_parsed_at":"2023-12-21T15:17:45.152Z","dependency_job_id":"72d12c86-671e-407b-9888-9cc795a9d967","html_url":"https://github.com/tintinweb/solidity-workspace","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"068c1351d48ea7a64a6d1452632bb925dd3273f4"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tintinweb%2Fsolidity-workspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tintinweb%2Fsolidity-workspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tintinweb%2Fsolidity-workspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tintinweb%2Fsolidity-workspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tintinweb","download_url":"https://codeload.github.com/tintinweb/solidity-workspace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251352546,"owners_count":21575859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["solidity","solidity-parser"],"created_at":"2024-10-03T15:43:25.995Z","updated_at":"2025-04-28T17:04:02.971Z","avatar_url":"https://github.com/tintinweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# solidity-workspace\n\nA simple workspace based interface to the [solidity-parser](https://github.com/solidity-parser/parser) and objectified Abstract Syntax Tree\n\n**Workspace Mode**\n\n```javascript\nconst ws = new Workspace();\nws.add('/path/to/solidity.sol');\nws.withParserReady().then(() =\u003e { \n  /* do things */\n  console.log(ws.sourceUnits);\n});\n```\n\n**Single Source Unit Mode**\n\n```javascript\nconst su = new SourceUnit().fromSource(sourceCode);\nconsole.log(su.imports);\n```\n\n## TLDR;\n\nThis library works like a headless IDE for solidity projects. Instead of manually parsing file-by-file you get meaningful objects you can work with. \n\n1. create a `ws = new Workspace()`\n2. asynchronously add solidity source code files to the workspace `ws.add('/path/to/solidity.sol', {content: optionalFileContent})`\n3. in the meantime, the added source units and their dependencies get parsed into. `new SourceUnit()` objects that provide easy access to solidity source unit properties\n4. add as many files as you want\n5. finally wait for all the tasks to finish `ws.withParserReady().then(() =\u003e { /* do things */})` (note: some internal magic requires 2 passes)\n6. search for contracts, source units, ....\n7. access source-unit, contract, function properties in an object oriented fashion\n\n\nCheck out the [cli.js](./src/cli.js) for an example on how to use this.\n\n```terminal\n⇒  solidity-workspace help\nsolidity-workspace \u003ccmd\u003e [args]\n\nCommands:\n  solidity-workspace flatten \u003cfiles..\u003e      show file contracts structure.\n  solidity-workspace dependencies           output a linearized list of smart\n  \u003cfiles..\u003e                                 contract dependencies (linerized\n                                            inherited parents)\n  solidity-workspace stats \u003cfiles..\u003e        random parser stats\n  solidity-workspace parse \u003cfiles..\u003e        print parsed objects\n  solidity-workspace funcsigs \u003cfiles..\u003e     print function signatures\n\nOptions:\n  -h, --help     Show help                                             [boolean]\n  -v, --version  Show version number                                   [boolean]\n```\n \n##### flatten (lexical)\n\n`#\u003e solidity-workspace flatten code/contracts/core/Core.sol --output flat.sol`\n\n##### stats\n\n```terminal\n#\u003e  solidity-workspace stats contracts/core/Core.sol                       \n→ fromFile(): contracts/core/Core.sol\n→ fromSource(): hash=daf3a03e589430ff94e3304fbbfcc1e7ed0134fb\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/proxy/Initializable.sol\n→ fromSource(): hash=f1177d352b287ab27db3368a956064663fb11fe5\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/utils/Address.sol\n→ fromSource(): hash=66db1de364ee244b292cf4cc5e63385e8f6b9420\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/core/Permissions.sol\n→ fromSource(): hash=6312be1e663c80ee4ee027b6a30a5bad7d950cb4\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/access/AccessControl.sol\n→ fromSource(): hash=e19379096fa4c8eaa567842d9c3f62f056fe17e6\n * parseAst()\nStruct member external call detection not yet implemented\nStruct member external call detection not yet implemented\nStruct member external call detection not yet implemented\nStruct member external call detection not yet implemented\nStruct member external call detection not yet implemented\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/utils/EnumerableSet.sol\n→ fromSource(): hash=899a51116900e639e216d778a3fb01d3f3b94b23\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/utils/Context.sol\n→ fromSource(): hash=02ebe0e93c5d1da25b91ba7f4cfb990a949263f8\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/core/IPermissions.sol\n→ fromSource(): hash=7ddf1c7a5b05af5b19a9b47530c8f5f0138aeba7\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/core/ICore.sol\n→ fromSource(): hash=1bae17efde3a1064ec30a279c6dde3d2cb622de7\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/token/IFei.sol\n→ fromSource(): hash=5cb090b66a4a2cb7cf298d38ff34bd2649a3d6fd\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n→ fromSource(): hash=198932076d74067dee7acdde834235339aa9d909\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/token/Fei.sol\n→ fromSource(): hash=a20178cdbec81f2383d13c5df8bf02f9418691d0\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol\n→ fromSource(): hash=856518dc7da0422e563ea7dc8fae4704c95b2388\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol\n→ fromSource(): hash=afd4175923b146603ba609a9e9e7f0b678aa1853\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/math/SafeMath.sol\n→ fromSource(): hash=3906485abfad296a4f57098778ae0b75fec61892\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/token/IIncentive.sol\n→ fromSource(): hash=5715475e1610cee51aa86360a8cf38c61abb34c9\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/refs/CoreRef.sol\n→ fromSource(): hash=e38ef7a3f55c505efc34483adf8de4d73278b0ee\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/refs/ICoreRef.sol\n→ fromSource(): hash=903484983c7c9e64a7896d11292c0dcaa14940a8\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): node_modules/@openzeppelin/contracts/utils/Pausable.sol\n→ fromSource(): hash=6c67f31034125f74c134dc0903c0f176cecccbd6\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\n→ fromFile(): contracts/dao/Tribe.sol\n→ fromSource(): hash=ba037beab397be55e837b36010e6b2cdeefcb732\n * parseAst()\n  * _resolveIdentifiers()\n  * parseImports()\nSourceUnits: 20\nContracts: 20\nUnique Contract Names (excluding duplicate contract names): 20\n```\n\n## 🙏 Contributors\n\n- [@vquelque](https://github.com/vquelque) - #2 #127 # 128\n\n## 🏆 References\n\n- https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor\u0026ssr=false#overview\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftintinweb%2Fsolidity-workspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftintinweb%2Fsolidity-workspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftintinweb%2Fsolidity-workspace/lists"}