Komodo RPC Library for modern JavaScript
This package doesn't include Komodo Binary because of security reason. Please setup Komodo Binary in your local first before run this package.
This project is bound by a [Code of Conduct][].
Nodejs: v10.13.0 or newer
Yarn: v1.9.4 or newer
Npm: v6.3.0 or newer
Install the package via yarn
:
yarn add kmd-rpc
or via npm
:
npm install kmd-rpc --save
To setup the Komodo daemon, download and unzip it here. Please follow this directory structure.
Your Project
├── bin
│ ├── mac
│ ├── linux
│ └── win
└── src
Create an application.
const path = require("path");
const KomodoRPC = require("kmd-rpc").default;
function getBinPath() {
return path.join(__dirname, "bin");
}
const api = KomodoRPC(application, {
bin: getBinPath()
});
Launch the daemon, we will launch KMDice for example.
const coin = "KMDICE";
const args = {
ac_supply: 10500000,
ac_reward: 2500000000,
ac_halving: 210000,
ac_cc: 2,
addressindex: 1,
spentindex: 1,
addnode: "144.76.217.232"
};
const komodod = await api.startDaemon(coin);
await komodod.start({
args
});
Wait until the daemon launches and start interact with it.
await komodod.waitUntilReady();
const getnewaddress = await api.rpc({
coin,
action: "getnewaddress"
});
debug(`getnewaddress = ${getnewaddress}`);
Stop the daemon.
if (komodod.isRunning() === true) {
const rs = await api.stop({
coin
});
}
Familiarize yourself with contributing on github https://guides.github.com/activities/contributing-to-open-source/
Feel free to submit issues and enhancement requests.
See also the list of contributors who participated in this project.
This project is licensed under the MIT license, Copyright (c) 2018 Komodo. For more information see LICENSE.md
.