sol2uml 2.2.3 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@ A visualisation tool for [Solidity](https://solidity.readthedocs.io/) contracts
6
6
  1. [Unified Modeling Language (UML)](https://en.wikipedia.org/wiki/Unified_Modeling_Language) [class diagram](https://en.wikipedia.org/wiki/Class_diagram) generator for Solidity contracts.
7
7
  2. Contract storage layout diagrams.
8
8
 
9
- UML class diagram of Open Zeppelin's ERC20 token contracts generated from [version 2.5.1](https://github.com/OpenZeppelin/openzeppelin-solidity/tree/v2.5.1/contracts/token/ERC20)
9
+ UML class diagram of Open Zeppelin's ERC20 token contracts generated from [version 4.7.3](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/v4.7.3/contracts/token/ERC20)
10
10
  ![Open Zeppelin ERC20](./examples/OpenZeppelinERC20.svg)
11
11
 
12
12
  See more contract diagrams [here](./examples/README.md).
@@ -160,13 +160,13 @@ To generate a diagram of all contracts under the contracts folder and its sub fo
160
160
  sol2uml class ./contracts
161
161
  ```
162
162
 
163
- To generate a diagram of EtherDelta's contract from the verified source code on [Etherscan](https://etherscan.io/address/0x8d12A197cB00D4747a1fe03395095ce2A5CC6819#code). The output wil be a svg file `0x8d12A197cB00D4747a1fe03395095ce2A5CC6819.svg` in the working folder.
163
+ To generate a diagram of EtherDelta's contract from the verified source code on [Etherscan](https://etherscan.io/address/0x8d12A197cB00D4747a1fe03395095ce2A5CC6819#code). The output will be a svg file `0x8d12A197cB00D4747a1fe03395095ce2A5CC6819.svg` in the working folder.
164
164
 
165
165
  ```bash
166
166
  sol2uml class 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819
167
167
  ```
168
168
 
169
- To generate a diagram of EtherDelta's contract from the verified source code on [Etherscan Ropsten](https://ropsten.etherscan.io/address/0xa19833bd291b66aB0E17b9C6d46D2Ec5fEC15190#code). The output wil be a svg file `0xa19833bd291b66aB0E17b9C6d46D2Ec5fEC15190.svg` in the working folder.
169
+ To generate a diagram of EtherDelta's contract from the verified source code on [Etherscan Ropsten](https://ropsten.etherscan.io/address/0xa19833bd291b66aB0E17b9C6d46D2Ec5fEC15190#code). The output will be a svg file `0xa19833bd291b66aB0E17b9C6d46D2Ec5fEC15190.svg` in the working folder.
170
170
 
171
171
  ```bash
172
172
  sol2uml class 0xa19833bd291b66aB0E17b9C6d46D2Ec5fEC15190 -n ropsten
@@ -184,10 +184,10 @@ To generate a diagram of all contracts in a single Solidity file, the output fil
184
184
  sol2uml class path/to/contracts/root/folder/solidity/file.sol -f png -o ./someFile.png
185
185
  ```
186
186
 
187
- To generate a diagram of all Solidity files under the `contracts` and `node_modules/openzeppelin-solidity` folders. The output will be `contracts.svg` and `contracts.png` files in the working folder.
187
+ To generate a diagram of all Solidity files under the `contracts` and `node_modules/@openzeppelin` folders. The output will be `contracts.svg` and `contracts.png` files in the working folder.
188
188
 
189
189
  ```bash
190
- sol2uml class ./contracts,node_modules/openzeppelin-solidity -f all -v
190
+ sol2uml class ./contracts,node_modules/@openzeppelin -f all -v
191
191
  ```
192
192
 
193
193
  To generate a diagram of all Solidity files under the working folder ignoring and files under the `solparse`, `@solidity-parser` and `ethlint` folders, which will be under the `node_modules` folder.
@@ -66,15 +66,23 @@ function addAssociationsToDot(umlClasses, classOptions = {}) {
66
66
  if (!classOptions.hideEnums) {
67
67
  // for each enum in the class
68
68
  sourceUmlClass.enums.forEach((enumId) => {
69
- // Draw aggregated link from contract to contract level Enum
70
- dotString += `\n${enumId} -> ${sourceUmlClass.id} [arrowhead=diamond, weight=2]`;
69
+ // Has the enum been filtered out? eg depth limited
70
+ const targetUmlClass = umlClasses.find((c) => c.id === enumId);
71
+ if (targetUmlClass) {
72
+ // Draw aggregated link from contract to contract level Enum
73
+ dotString += `\n${enumId} -> ${sourceUmlClass.id} [arrowhead=diamond, weight=2]`;
74
+ }
71
75
  });
72
76
  }
73
77
  if (!classOptions.hideStructs) {
74
78
  // for each struct in the class
75
79
  sourceUmlClass.structs.forEach((structId) => {
76
- // Draw aggregated link from contract to contract level Struct
77
- dotString += `\n${structId} -> ${sourceUmlClass.id} [arrowhead=diamond, weight=2]`;
80
+ // Has the struct been filtered out? eg depth limited
81
+ const targetUmlClass = umlClasses.find((c) => c.id === structId);
82
+ if (targetUmlClass) {
83
+ // Draw aggregated link from contract to contract level Struct
84
+ dotString += `\n${structId} -> ${sourceUmlClass.id} [arrowhead=diamond, weight=2]`;
85
+ }
78
86
  });
79
87
  }
80
88
  // for each association in that class
@@ -11,7 +11,7 @@ const parserUmlClasses = async (fileFolderAddress, options) => {
11
11
  };
12
12
  if ((0, regEx_1.isAddress)(fileFolderAddress)) {
13
13
  debug(`argument ${fileFolderAddress} is an Ethereum address so checking Etherscan for the verified source code`);
14
- const etherscanApiKey = options.etherscanApiKey || 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1';
14
+ const etherscanApiKey = options.apiKey || 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1';
15
15
  const etherscanParser = new parserEtherscan_1.EtherscanParser(etherscanApiKey, options.network);
16
16
  result = await etherscanParser.getUmlClasses(fileFolderAddress);
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sol2uml",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Solidity contract visualisation tool.",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -23,22 +23,22 @@
23
23
  "@solidity-parser/parser": "^0.14.3",
24
24
  "axios": "^0.27.2",
25
25
  "axios-debug-log": "^0.8.4",
26
- "commander": "^9.4.0",
26
+ "commander": "^9.4.1",
27
27
  "convert-svg-to-png": "^0.6.4",
28
28
  "debug": "^4.3.4",
29
- "ethers": "^5.6.9",
29
+ "ethers": "^5.7.1",
30
30
  "js-graph-algorithms": "^1.0.18",
31
31
  "klaw": "^4.0.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/jest": "^28.1.6",
34
+ "@openzeppelin/contracts": "4.7.3",
35
+ "@types/jest": "^29.1.1",
35
36
  "@types/klaw": "^3.0.3",
36
- "jest": "^28.1.3",
37
- "openzeppelin-solidity": "2.5.1",
37
+ "jest": "^29.1.2",
38
38
  "prettier": "^2.7.1",
39
- "ts-jest": "^28.0.7",
39
+ "ts-jest": "^29.0.3",
40
40
  "ts-node": "^10.9.1",
41
- "typescript": "^4.7.4"
41
+ "typescript": "^4.8.4"
42
42
  },
43
43
  "files": [
44
44
  "lib/*.js",