Comparing version 2.5.5 to 2.5.6
@@ -13,3 +13,3 @@ import { ASTNode } from '@solidity-parser/parser/dist/src/ast-types'; | ||
readonly url: string; | ||
constructor(apikey?: string, network?: Network); | ||
constructor(apikey?: string, network?: Network, url?: string); | ||
/** | ||
@@ -16,0 +16,0 @@ * Parses the verified source code files from Etherscan |
@@ -31,5 +31,9 @@ "use strict"; | ||
class EtherscanParser { | ||
constructor(apikey = 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1', network = 'mainnet') { | ||
constructor(apikey = 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1', network = 'mainnet', url) { | ||
this.apikey = apikey; | ||
this.network = network; | ||
if (url) { | ||
this.url = url; | ||
return; | ||
} | ||
if (!exports.networks.includes(network)) { | ||
@@ -36,0 +40,0 @@ throw new Error(`Invalid network "${network}". Must be one of ${exports.networks}`); |
@@ -6,2 +6,3 @@ import { Network } from './parserEtherscan'; | ||
network?: Network; | ||
explorerUrl?: string; | ||
subfolders?: string; | ||
@@ -8,0 +9,0 @@ ignoreFilesOrFolders?: string; |
@@ -20,3 +20,3 @@ "use strict"; | ||
const etherscanApiKey = options.apiKey || 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1'; | ||
const etherscanParser = new parserEtherscan_1.EtherscanParser(etherscanApiKey, options.network); | ||
const etherscanParser = new parserEtherscan_1.EtherscanParser(etherscanApiKey, options.network, options.explorerUrl); | ||
result = await etherscanParser.getUmlClasses(fileFolderAddress); | ||
@@ -23,0 +23,0 @@ } |
@@ -32,6 +32,7 @@ #! /usr/bin/env node | ||
.option('-i, --ignoreFilesOrFolders <filesOrFolders>', 'comma separated list of files or folders to ignore') | ||
.addOption(new commander_1.Option('-n, --network <network>', 'Ethereum network') | ||
.addOption(new commander_1.Option('-n, --network <network>', 'Ethereum network which maps to a blockchain explorer') | ||
.choices(parserEtherscan_1.networks) | ||
.default('mainnet') | ||
.env('ETH_NETWORK')) | ||
.addOption(new commander_1.Option('-e, --explorerUrl <url>', 'Override network with custom blockchain explorer API URL. eg Polygon Mumbai testnet https://api-testnet.polygonscan.com/api').env('EXPLORER_URL')) | ||
.addOption(new commander_1.Option('-k, --apiKey <key>', 'Blockchain explorer API key. eg Etherscan, Arbiscan, Optimism, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key').env('SCAN_API_KEY')) | ||
@@ -206,3 +207,3 @@ .option('-bc, --backColor <color>', 'Canvas background color. "none" will use a transparent canvas.', 'white') | ||
}; | ||
const etherscanParser = new parserEtherscan_1.EtherscanParser(combinedOptions.apiKey, combinedOptions.network); | ||
const etherscanParser = new parserEtherscan_1.EtherscanParser(combinedOptions.apiKey, combinedOptions.network, combinedOptions.explorerUrl); | ||
const { solidityCode, contractName } = await etherscanParser.getSolidityCode(contractAddress); | ||
@@ -244,3 +245,3 @@ // Write Solidity to the contract address | ||
throw Error(`Invalid line buffer "${options.lineBuffer}". Must be a number`); | ||
const etherscanParser = new parserEtherscan_1.EtherscanParser(combinedOptions.apiKey, combinedOptions.network); | ||
const etherscanParser = new parserEtherscan_1.EtherscanParser(combinedOptions.apiKey, combinedOptions.network, combinedOptions.explorerUrl); | ||
// Get verified Solidity code from Etherscan and flatten | ||
@@ -247,0 +248,0 @@ const { solidityCode: codeA, contractName: contractNameA } = await etherscanParser.getSolidityCode(addressA, combinedOptions.aFile); |
{ | ||
"name": "sol2uml", | ||
"version": "2.5.5", | ||
"version": "2.5.6", | ||
"description": "Solidity contract visualisation tool.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -58,4 +58,5 @@ # Solidity 2 UML | ||
-i, --ignoreFilesOrFolders <filesOrFolders> comma separated list of files or folders to ignore | ||
-n, --network <network> Ethereum network (choices: "mainnet", "goerli", "sepolia", "polygon", "arbitrum", "avalanche", "bsc", "crono", "fantom", "moonbeam", | ||
-n, --network <network> Ethereum network which maps to a blockchain explorer (choices: "mainnet", "goerli", "sepolia", "polygon", "arbitrum", "avalanche", "bsc", "crono", "fantom", "moonbeam", | ||
"optimism", "gnosis", "celo", default: "mainnet", env: ETH_NETWORK) | ||
-e, --explorerUrl <url> Override network with custom blockchain explorer API URL. eg Polygon Mumbai testnet https://api-testnet.polygonscan.com/api (env: EXPLORER_URL) | ||
-k, --apiKey <key> Blockchain explorer API key. eg Etherscan, Arbiscan, Optimism, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key (env: SCAN_API_KEY) | ||
@@ -62,0 +63,0 @@ -bc, --backColor <color> Canvas background color. "none" will use a transparent canvas. (default: "white") |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226709
4413
364