Socket
Socket
Sign inDemoInstall

@warren-bank/dapp-console

Package Overview
Dependencies
79
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

40

bin/dapp-console.js

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

const timer = require('timers')
const path = require('path')

@@ -154,8 +155,39 @@ const argv = yargs

const run_script = function(script){
var result
const run_script = function(script, fpath){
var fcontext, result
// wrap 'script' code inside an anonymous self-invoking function.
// by doing so, the `return` keyword can be used to pass a `Promise` to 'result'.
// otherwise, the final statement in the block of 'script' code would need to evaluate to the `Promise`,
// which, imho, is a coding style that's restrictive and awkward to use.
script = '(function(){' + "\n" + script + "\n" + '})()'
fcontext = {}
if (fpath){
// for scripts that are read from an input file,
// include additional filesystem-related context variables.
fcontext = (function(){
var $cwd, $realpath, $dirname, $filename
$cwd = process.cwd()
if (path.isAbsolute(fpath)){
$realpath = fpath
}
else {
$realpath = $cwd + '/' + fpath
$realpath = path.normalize($realpath)
}
$dirname = path.dirname($realpath)
$filename = path.basename($realpath)
return {
"__cwd": $cwd,
"__realpath": $realpath,
"__dirname": $dirname,
"__filename": $filename
}
})()
}
result = vm.runInNewContext(
script,
Object.assign({}, contract_objects, {web3}, {console, fs, timer})
Object.assign({}, fcontext, contract_objects, {web3}, {console, path, fs, timer})
)

@@ -174,3 +206,3 @@

else if (input_file){
run_script(fs.readFileSync(input_file).toString())
run_script(fs.readFileSync(input_file).toString(), input_file)
}

@@ -177,0 +209,0 @@

2

package.json
{
"name": "@warren-bank/dapp-console",
"version": "1.0.0",
"version": "1.1.0",
"dependencies": {

@@ -5,0 +5,0 @@ "web3": "^0.19.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc