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 1.1.27 to 1.1.28

1

lib/converter.d.ts

@@ -9,4 +9,5 @@ import { ClassOptions } from './dotGenerator';

export declare function convertDot2Svg(dot: string): any;
export declare function writeSolidity(code: string, filename?: string): void;
export declare function writeDot(dot: string, dotFilename?: string): void;
export declare function writeSVG(svg: any, svgFilename?: string, outputFormats?: OutputFormats): Promise<void>;
export declare function writePng(svg: any, filename: string): Promise<void>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.writePng = exports.writeSVG = exports.writeDot = exports.convertDot2Svg = exports.addAssociationsToDot = exports.convertUmlClasses2Dot = exports.convertUmlClassesToSvg = exports.generateFilesFromUmlClasses = void 0;
exports.writePng = exports.writeSVG = exports.writeDot = exports.writeSolidity = exports.convertDot2Svg = exports.addAssociationsToDot = exports.convertUmlClasses2Dot = exports.convertUmlClassesToSvg = exports.generateFilesFromUmlClasses = void 0;
const fs_1 = require("fs");

@@ -162,2 +162,15 @@ const path = require('path');

exports.convertDot2Svg = convertDot2Svg;
function writeSolidity(code, filename = 'solidity') {
const outputFile = filename + '.sol';
debug(`About to write Solidity to file ${outputFile}`);
fs_1.writeFile(outputFile, code, (err) => {
if (err) {
throw new verror_1.VError(err, `Failed to write Solidity to file ${outputFile}`);
}
else {
console.log(`Solidity written to ${outputFile}`);
}
});
}
exports.writeSolidity = writeSolidity;
function writeDot(dot, dotFilename = 'classDiagram.dot') {

@@ -164,0 +177,0 @@ debug(`About to write Dot file to ${dotFilename}`);

@@ -17,2 +17,9 @@ import { ASTNode } from '@solidity-parser/parser/dist/src/ast-types';

/**
* Get Solidity code from Etherscan for a contract and merges all files
* into one long string of Solidity code.
* @param contractAddress Ethereum contract address with a 0x prefix
* @return Promise string of Solidity code
*/
getSolidityCode(contractAddress: string): Promise<string>;
/**
* Parses Solidity source code into an ASTNode object

@@ -19,0 +26,0 @@ * @param sourceCode Solidity source code

@@ -42,2 +42,16 @@ "use strict";

/**
* Get Solidity code from Etherscan for a contract and merges all files
* into one long string of Solidity code.
* @param contractAddress Ethereum contract address with a 0x prefix
* @return Promise string of Solidity code
*/
async getSolidityCode(contractAddress) {
const sourceFiles = await this.getSourceCode(contractAddress);
let solidityCode = '';
sourceFiles.forEach((sourceFile) => {
solidityCode += sourceFile.code;
});
return solidityCode;
}
/**
* Parses Solidity source code into an ASTNode object

@@ -44,0 +58,0 @@ * @param sourceCode Solidity source code

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

.option('-b, --baseContractNames <value>', 'only output contracts connected to these comma separated base contract names')
.option('-f, --outputFormat <value>', 'output file format: svg, png, dot or all', 'svg')
.option('-f, --outputFormat <value>', 'output file format: svg, png, sol, dot or all', 'svg')
.option('-o, --outputFileName <value>', 'output file name')

@@ -60,2 +60,9 @@ .option('-d, --depthLimit <depth>', 'number of sub folders that will be recursively searched for Solidity files. Default -1 is unlimited', '-1')

const etherscanParser = new etherscanParser_1.EtherscanParser(etherscanApiKey, options.network);
// If output is Solidity code
if (options.outputFormat === 'sol') {
const solidityCode = await etherscanParser.getSolidityCode(fileFolderAddress);
// Write Solidity to the contract address
converter_1.writeSolidity(solidityCode, fileFolderAddress);
return;
}
umlClasses = await etherscanParser.getUmlClasses(fileFolderAddress);

@@ -62,0 +69,0 @@ }

2

package.json
{
"name": "sol2uml",
"version": "1.1.27",
"version": "1.1.28",
"description": "Unified Modeling Language (UML) class diagram generator for Solidity contracts",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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

-b, --baseContractNames <value> only output contracts connected to these comma separated base contract names
-f, --outputFormat <value> output file format: svg, png, dot or all (default: "svg")
-f, --outputFormat <value> output file format: svg, png, sol, dot or all (default: "svg")
-o, --outputFileName <value> output file name

@@ -55,0 +55,0 @@ -d, --depthLimit <depth> number of sub folders that will be recursively searched for Solidity files. Default -1 is unlimited (default: -1)

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