npm.io
2.0.3 • Published 8 years ago

webu

Licence
LGPL-3.0
Version
2.0.3
Deps
5
Size
2.0 MB
Vulns
2
Weekly
0

IrChain JavaScript API

Join the chat at https://gitter.im/irchain/webu.js

This is the IrChain compatible JavaScript API which implements the Generic JSON RPC spec. It's available on npm as a node module, for bower and component as an embeddable js and as a meteor.js package.

NPM version Build Status dependency status dev dependency status Coverage Status Stories in Ready

You need to run a local IrChain node to use this library.

Documentation

Installation

Node.js

npm install webu
Yarn
yarn add webu
Meteor.js
meteor add irchain:webu
As Browser module

Bower

bower install webu

Component

component install irchain/webu.js
  • Include webu.min.js in your html file. (not required for the meteor package)

Usage

Use the webu object directly from global namespace:

console.log(webu); // {irc: .., shh: ...} // it's here!

Set a provider (HttpProvider)

if (typeof webu !== 'undefined') {
  webu = new Webu(webu.currentProvider);
} else {
  // set the provider you want from Webu.providers
  webu = new Webu(new Webu.providers.HttpProvider("http://localhost:8545"));
}

Set a provider (HttpProvider using HTTP Basic Authentication)

webu.setProvider(new webu.providers.HttpProvider('http://host.url', 0, BasicAuthUsername, BasicAuthPassword));

There you go, now you can use it:

var coinbase = webu.irc.coinbase;
var balance = webu.irc.getBalance(coinbase);

You can find more examples in example directory.

Contribute!

Requirements
  • Node.js
  • npm
Building (gulp)
gulp
Testing (mocha)
npm test
Community
Other implementations

Keywords