Socket
Book a DemoInstallSign in
Socket

bitshares-rpc

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitshares-rpc

Simple wrapper for the jayson library to make rpc calls to the Bitshares client

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

NPM version NPM downloads MIT License

#Bitshares-rpc

A very simple API wrapper for the excellent jayson library and Q for promises to make an RPC client for Bitshares.

##Installation npm install bitshares-rpc

##Usage var bitshares = require('bitshares-rpc'); var config = require('config.json');

var bitshares_client = bitshares.client({
	port: config.port,  // Optional - default 1775
	hostname: config.hostname,   // Optional - default 127.0.0.1
	username: config.username,
	password: config.password
});

bitshares_client.request('RPC_METHOD', [PARAMS]).then(function(result) {
	// Use result
})
.catch(function(error) {
	// Handle error
});

RPC_METHOD can by any method found in the Bitshares client.

PARAMS is optional for methods that do not take parameters, if needed it should be an array of parameters.

##Examples

Some specific use cases:

bitshares_client.request('getinfo')
.then(function(result) {
	console.log(result);
})
.catch(function(error) {
	console.log(error);
});

bitshares_client.request('blockchain_list_delegates',[10, 10])
.then(function(result) {
	console.log(result);
})
.catch(function(error) {
	console.log(error);
});

Chaining with Q:

var Q = require('q');
Q.all([
	bitshares_client.request('getinfo'),
	bitshares_client.request('blockchain_list_delegates',[10, 10])
])
.then(function(result) {
	var getinfo = result[0];
	var delegates = result[1];
})
.catch(function(error) {
	console.log(error);
})

License

bitshares-rpc is freely distributable under the terms of the MIT license.

FAQs

Package last updated on 02 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.