1.0.0 • Published 6 years ago

dsocialjs v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

dSocial.js

A lightweight JavaScript library for dSocial

Install

npm install dsocialjs --save

Usage

var dsocial = require('dsocialjs');

// Init WebSocket client
var client = new dsocial.Client('wss://greatchain.dpays.io');

// Get accounts
client.call('get_accounts', ['jared'], function(err, result) {
  console.log(err, result);
});

Promises

You can also use dSocial.js with promises by promisifying dSocial with bluebird as in:

var dsocial = require('dsocialjs');
bluebird.promisifyAll(dsocial.Client.prototype);

It'll add a Async to all dSocial functions (e.g. return client.callAsync().then())

// So instead of writing client.request('get_accounts', ['jared'], cb); you have to write:
return client.callAsync('get_accounts', ['jared']).then(function(result) {
  console.log(result); // => [{ id: 26921, name: 'jared' ...]
});

License

MIT.

1.0.0

6 years ago