2.0.3 • Published 7 years ago
webu v2.0.3
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 webuYarn
yarn add webuMeteor.js
meteor add irchain:webuAs Browser module
Bower
bower install webuComponent
component install irchain/webu.js- Include
webu.min.jsin 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)
gulpTesting (mocha)
npm testCommunity
Other implementations
- Python Webu.py
- Haskell hs-webu
- Java webuj
- Scala webuj-scala
- Purescript purescript-webu
- PHP webu.php