webu
v2.0.3
Published
IrChain JavaScript API, middleware to talk to a irchain node over RPC
Downloads
33
Readme
IrChain JavaScript API
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.
You need to run a local IrChain node to use this library.
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
- Python Webu.py
- Haskell hs-webu
- Java webuj
- Scala webuj-scala
- Purescript purescript-webu
- PHP webu.php