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

sol2uml

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sol2uml - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

lib/slotValues.d.ts

10

lib/converterAST2Classes.js

@@ -175,2 +175,12 @@ "use strict";

});
// Is the variable a constant that could be used in declaring fixed sized arrays
if (variable.isDeclaredConst) {
if (variable?.expression.type === 'NumberLiteral') {
umlClass.constants.push({
name: variable.name,
value: parseInt(variable.expression.number),
});
}
// TODO handle expressions. eg N_COINS * 2
}
});

@@ -177,0 +187,0 @@ // Recursively parse variables for associations

16

lib/converterClasses2Storage.js

@@ -173,3 +173,3 @@ "use strict";

// All array dimensions must be fixed. eg [2][3][8].
const result = attribute.type.match(/(\w+)(\[([1-9][0-9]*)\])+$/);
const result = attribute.type.match(/(\w+)(\[([\w][\w]*)\])+$/);
// The above will not match any dynamic array dimensions, eg [],

@@ -184,5 +184,15 @@ // as there needs to be one or more [0-9]+ in the square brackets

// to get a total number of array elements
const arrayDimensions = attribute.type.match(/\[\d+/g);
const arrayDimensions = attribute.type.match(/\[\w+/g);
const dimensionsStr = arrayDimensions.map((d) => d.slice(1));
const dimensions = dimensionsStr.map((d) => parseInt(d));
const dimensions = dimensionsStr.map((dimension) => {
const dimensionNum = parseInt(dimension);
if (!isNaN(dimensionNum))
return dimensionNum;
// Try and size array dimension from declared constants
const constant = umlClass.constants.find((constant) => constant.name === dimension);
if (constant) {
return constant.value;
}
throw Error(`Could not size fixed sized array with dimension "${dimension}"`);
});
let elementSize;

@@ -189,0 +199,0 @@ // If a fixed sized array

2

lib/sol2uml.js

@@ -94,3 +94,3 @@ #! /usr/bin/env node

.command('storage')
.description("Visually display a contract's storage slots.\n\nWARNING: sol2uml does not use the Solidity compiler so may differ with solc. A known example is storage arrays declared with a constant, immutable or expression will show as only taking one slot but it could be more. Storage arrays declared with an integer work.")
.description("Visually display a contract's storage slots.\n\nWARNING: sol2uml does not use the Solidity compiler so may differ with solc. A known example is fixed-sized arrays declared with an expression will fail to be sized.")
.argument('<fileFolderAddress>', 'file name, base folder or contract address')

@@ -97,0 +97,0 @@ .option('-c, --contractName <value>', 'Contract name in local Solidity files. Not needed when using an address as the first argument.')

@@ -66,2 +66,6 @@ export declare enum Visibility {

}
export interface Constants {
name: string;
value: number;
}
export interface ClassProperties {

@@ -80,2 +84,3 @@ name: string;

};
constants?: Constants[];
}

@@ -90,2 +95,3 @@ export declare class UmlClass implements ClassProperties {

stereotype?: ClassStereotype;
constants: Constants[];
attributes: Attribute[];

@@ -92,0 +98,0 @@ operators: Operator[];

@@ -46,2 +46,3 @@ "use strict";

constructor(properties) {
this.constants = [];
this.attributes = [];

@@ -48,0 +49,0 @@ this.operators = [];

{
"name": "sol2uml",
"version": "2.0.4",
"version": "2.0.5",
"description": "Unified Modeling Language (UML) class diagram generator for Solidity contracts",

@@ -28,3 +28,2 @@ "main": "./lib/index.js",

"debug": "^4.3.4",
"ethers": "^5.6.9",
"js-graph-algorithms": "^1.0.18",

@@ -31,0 +30,0 @@ "klaw": "^4.0.1"

@@ -115,3 +115,3 @@ # Solidity 2 UML

WARNING: sol2uml does not use the Solidity compiler so may differ with solc. A known example is storage arrays declared with a constant, immutable or expression will show as only taking one slot but it could be more. Storage arrays declared with an integer work.
WARNING: sol2uml does not use the Solidity compiler so may differ with solc. A known example is fixed-sized arrays declared with an expression will fail to be sized.

@@ -118,0 +118,0 @@ Arguments:

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