Network Interface layer for nutmeg components
npm install nutmeg-networkinterfacenpm install -P nutmeg-networkinterfaceFrom the consuming module or script:
``javascript
import {Network, Block} from 'nutmeg-networkinterface';
var interface = Network.intialize(); //returns a newly created NetworkInterface object
interface.getLatestBlock(); //latest block
var block = new Block();
interface.submitBlock(block); //returns true for success
//To clean up
interface.kill();
`
bash
$ npm -v
# 5.5.1
`
If not, install node via homebrew and validate that things are working by trying the above command again
`bash
$ brew install node
# ...
# == Summary
# 🍺 /usr/local/Cellar/node/8.9.1: 5,012 files, 49.4MB
`
Next install Babel dependencies to compile our ES6 to ES5
`bash
$ npm install --save-dev babel-cli babel-preset-es2015
# ...
# + babel-cli@6.26.0
# + babel-preset-es2015@6.24.1
# added 274 packages in 12.553s
`
Install the test devDependencies`bash
$ npm install -D babel-core chai mocha nyc
`Install additional dependencies
`bash
$npm install -D esdoc esdoc-standard-plugin
`Running
npm run test should result in the tests running (and ideally passing), which will tell you the setup is working.NPM Commands
$3
To run all the tests and coverage analysis use npm run testTo run a single test use
npm run test:single To run a single test with coverage analysis use
npm run test:single-coverage $3
To generate the documentation run npm run jsdocThis will generate an
index.html in the ./docs directory. To view open docs/index.html> Note: The jsdoc step is run as apart of the build step, which is included as part of the test step by default.
$3
To remove the generated content, use npm run clean`> Note: This step is run as part of the pretest step by default. Which means it is run before the test, test:single, and test:single-coverage targets.