Skip to content

dSocialNetwork/dsocialjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Javascript Library For Interacting With dSocial

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published