monerojs
A Monero library written in ES6 JavaScript
This library has two main parts: a Monero daemon (monerod
) JSON-RPC API wrapper, daemonRPC.js
, and a Monero wallet (monero-wallet-rpc
) JSON-RPC API wrapper, walletRPC.js
.
Requirements
- Node.js
- A Monero node (remote nodes support most, but not all, methods.)
Installation
npm install monerojs
--save
optional
Testing
Install dependencies (npm install
) and then run npm test
Usage
JSON-RPC interfaces and their methods are wrapped in promises. Much more exhaustive examples can be found in the tests
monerod
)
Autoconnect to Monero daemon (const Monero = ; var daemonRPC = autoconnect: true ;
Connect to specific Monero daemons
// const daemonRPC = new Monero.daemonRPC().then(...).catch(...); // Connect with defaults// const daemonRPC = new Monero.daemonRPC('127.0.0.1', 28081, 'user', 'pass', 'http').then(...).catch(...); // Example of passing in parameters// const daemonRPC = new Monero.daemonRPC({ port: 28081, protocol: 'https' }).then(...).catch(...); // Parameters can be passed in as an object/dictionaryconst daemonRPC = // Connect with defaults;
monero-wallet-rpc
)
Connect to Monero wallet (// const walletRPC = new Monero.walletRPC('127.0.0.1', 28083, 'user', 'pass', 'http').then(...).catch(...); // Example of passing in parameters// const walletRPC = new Monero.walletRPC({ port: 28083, protocol: 'https' }).then(...).catch(...); // Parameters can be passed in as an object/dictionary// const walletRPC = new Monero.walletRPC({ autoconnect: true }).then(...).catch(...); // Autoconnectconst walletRPC = // Connect with defaults;
Check if Monero wallet is available (running)
var checkForLocalWalletRPC = initialize: false ;