matrixbitd-rpc
MatrixBit Client Library to connect to MatrixBit Core (matrixbitd) via RPC
Install
matrixbitd-rpc runs on node, and can be installed via npm:
npm install matrixbitcore-rpc
Usage
RpcClient
Config parameters :
- protocol : (string - optional) - (default: 'https') - Set the protocol to be used. Either `http` or `https`.
- user : (string - optional) - (default: 'user') - Set the user credential.
- pass : (string - optional) - (default: 'pass') - Set the password credential.
- host : (string - optional) - (default: '127.0.0.1') - The host you want to connect with.
- port : (integer - optional) - (default: 7170) - Set the port on which perform the RPC command.
Promise vs callback based
require('matrixbitcore-rpc/promise')
to have promises returnedrequire('matrixbitcore-rpc')
to have callback functions returned
Examples
Config:
var config = protocol: 'http' user: 'raiden' pass: 'local321' host: '127.0.0.1' port: 17170;
Promise based:
var RpcClient = ;var rpc = config; rpc
Callback based (legacy):
var { var bitcore = ; var RpcClient = ; var rpc = config; var txids = ; { rpc; } ;};
Help
You can dynamically access to the help of each method by doing
const RpcClient = require('matrixbitcore-rpc');
var client = new RPCclient({
protocol:'http',
user: 'raiden',
pass: 'local321',
host: '127.0.0.1',
port: 17170
});
var cb = function (err, data) {
console.log(data)
};
// Get full help
client.help(cb);
// Get help of specific method
client.help('getinfo',cb);
Contributing
License
MIT © MatrixBit Core Group, Inc.