sol2uml 2.1.7 → 2.1.8

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.
@@ -29,8 +29,8 @@ const addStorageValues = async (url, contractAddress, storage, blockTag) => {
29
29
  const valueVariables = storage.variables.filter((s) => !s.noValue);
30
30
  const slots = valueVariables.map((s) => s.fromSlot);
31
31
  const values = await (0, slotValues_1.getStorageValues)(url, contractAddress, slots, blockTag);
32
- valueVariables.forEach((storage, i) => {
33
- storage.value = values[i];
32
+ valueVariables.forEach((valueVariable, i) => {
33
+ valueVariable.value = values[i];
34
34
  });
35
35
  };
36
36
  exports.addStorageValues = addStorageValues;
@@ -49,7 +49,7 @@ const convertClasses2Storages = (contractName, umlClasses, contractFilename) =>
49
49
  const contractFilenameError = contractFilename
50
50
  ? ` in filename "${contractFilename}"`
51
51
  : '';
52
- throw Error(`Failed to find contract with name "${contractName}"${contractFilenameError}`);
52
+ throw Error(`Failed to find contract with name "${contractName}"${contractFilenameError}.\nIs the \`-c --contract <name>\` option correct?`);
53
53
  }
54
54
  debug(`Found contract "${contractName}" in ${umlClass.absolutePath}`);
55
55
  const storages = [];
package/lib/sol2uml.js CHANGED
@@ -110,6 +110,10 @@ WARNING: sol2uml does not use the Solidity compiler so may differ with solc. A k
110
110
  ...command.parent._optionValues,
111
111
  ...options,
112
112
  };
113
+ // If not an address and the contractName option has not been specified
114
+ if (!(0, regEx_1.isAddress)(fileFolderAddress) && !combinedOptions.contract) {
115
+ throw Error(`Must use the \`-c, --contract <name>\` option to specify the contract to draw the storage diagram for when sourcing from local files.\nThis option is not needed when sourcing from a blockchain explorer with a contract address.`);
116
+ }
113
117
  let { umlClasses, contractName } = await (0, parserGeneral_1.parserUmlClasses)(fileFolderAddress, combinedOptions);
114
118
  contractName = combinedOptions.contract || contractName;
115
119
  const storages = (0, converterClasses2Storage_1.convertClasses2Storages)(contractName, umlClasses, combinedOptions.contractFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sol2uml",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "Solidity contract visualisation tool.",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",