alarmxd-rpc.js
A client library to connect to Alarmx Core RPC in JavaScript.
Get Started
alarmxd-rpc.js runs on node, and can be installed via npm:
npm install alarmxd-rpc
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: 2578) - Set the port on which perform the RPC command.
Promise vs callback based
require('alarmxd-rpc/promise')
to have promises returnedrequire('alarmxd-rpc')
to have callback functions returned
Examples
Config:
var config = protocol: 'http' user: 'alarmx' pass: 'local321' host: '127.0.0.1' port: 92579;
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('alarmxd-rpc');
var client = new RPCclient({
protocol:'http',
user: 'alarmx',
pass: 'local321',
host: '127.0.0.1',
port: 92579
});
var cb = function (err, data) {
console.log(data)
};
client.help(cb); //Get full help
client.help('getinfo',cb); //Get help of specific method
License
Code released under the MIT license.
Copyright 2013-2014 BitPay, Inc.