Comparing version 2.5.15 to 2.5.16
@@ -12,2 +12,3 @@ "use strict"; | ||
const SlotValueCache_1 = require("./SlotValueCache"); | ||
const ethers_1 = require("ethers"); | ||
const debug = require('debug')('sol2uml'); | ||
@@ -215,3 +216,3 @@ /** | ||
: (0, utils_1.hexValue)(bignumber_1.BigNumber.from(blockTag)); | ||
// get cached values and missing slot keys from from cache | ||
// get cached values and missing slot keys from the cache | ||
const { cachedValues, missingKeys } = SlotValueCache_1.SlotValueCache.readSlotValues(slotKeys); | ||
@@ -222,2 +223,10 @@ // If all values are in the cache then just return the cached values | ||
} | ||
// Check we are pointing to the correct chain by checking the contract has code | ||
const provider = new ethers_1.ethers.providers.JsonRpcProvider(url); | ||
const code = await provider.getCode(contractAddress, block); | ||
if (!code || code === '0x') { | ||
const msg = `Address ${contractAddress} has no code. Check your "-u, --url" option or "NODE_URL" environment variable is pointing to the correct node.\nurl: ${url}`; | ||
console.error(msg); | ||
throw Error(msg); | ||
} | ||
debug(`About to get ${slotKeys.length} storage values for ${contractAddress} at block ${blockTag} from slot ${missingKeys[0].toString()}`); | ||
@@ -224,0 +233,0 @@ // Get the values for the missing slot keys |
@@ -5,3 +5,2 @@ #! /usr/bin/env node | ||
const commander_1 = require("commander"); | ||
const ethers_1 = require("ethers"); | ||
const path_1 = require("path"); | ||
@@ -20,2 +19,3 @@ const converterClasses2Dot_1 = require("./converterClasses2Dot"); | ||
const writerFiles_1 = require("./writerFiles"); | ||
const block_1 = require("./utils/block"); | ||
const clc = require('cli-color'); | ||
@@ -176,8 +176,3 @@ const program = new commander_1.Command(); | ||
} | ||
let block = combinedOptions.block; | ||
if (block === 'latest') { | ||
const provider = new ethers_1.ethers.providers.JsonRpcProvider(combinedOptions.url); | ||
block = await provider.getBlockNumber(); | ||
debug(`Latest block is ${block}. All storage slot values will be from this block.`); | ||
} | ||
let block = await (0, block_1.getBlock)(combinedOptions); | ||
// Get slot values for each storage section | ||
@@ -184,0 +179,0 @@ for (const storageSection of storageSections) { |
{ | ||
"name": "sol2uml", | ||
"version": "2.5.15", | ||
"version": "2.5.16", | ||
"description": "Solidity contract visualisation tool.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
263456
53
5187