nutmeg-networkinterface
v0.1.6
Published
Network Interface layer for nutmeg components
Downloads
4
Readme
Nutmeg Network Interface
Goal
Serve as a common layer between various networks (initially Monero) so that other components can interact with the network and not have to adjust behavior for different networks.
Milestones
- Create and publish stub implementation - Released November 25th, 2017
- version 0.1.0
- implementations use console log to provide some feedback to developers
- Create and publish working Monero implementation - WIP
Usage
This package should be consumed by installing from npm, npm install -P nutmeg-networkinterface
From the consuming module or script:
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();
Developer Setup
Check if you have node installed
$ npm -v
# 5.5.1
If not, install node via homebrew and validate that things are working by trying the above command again
$ 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
$ npm install --save-dev babel-cli babel-preset-es2015
# ...
# + [email protected]
# + [email protected]
# added 274 packages in 12.553s
Install the test devDependencies
$ npm install -D babel-core chai mocha nyc
Install additional dependencies
$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
Testing
To run all the tests and coverage analysis use npm run test
To run a single test use npm run test:single <path to test file>
To run a single test with coverage analysis use npm run test:single-coverage <path to test file>
JSDoc
To generate the documentation run npm run jsdoc
This 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.
Clean
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.