webze.js version 0.14.0 supports multiple instances of webze object. To migrate to this version, please follow the guide:
-var webze = require('webze');
+var Webze = require('webze');
+var webze = new Webze();
This is the Zerium 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 Zerium node to use this library.
npm install webze
yarn add webze
meteor add zerium:webze
Bower
bower install webze
Component
component install zerium/webze.js
- Include
webze.min.js
in your html file. (not required for the meteor package)
Use the webze
object directly from global namespace:
console.log(webze); // {eth: .., shh: ...} // it's here!
Set a provider (HttpProvider)
if (typeof webze !== 'undefined') {
webze = new Webze(webze.currentProvider);
} else {
// set the provider you want from Webze.providers
webze = new Webze(new Webze.providers.HttpProvider("http://localhost:8545"));
}
Set a provider (HttpProvider using HTTP Basic Authentication)
webze.setProvider(new webze.providers.HttpProvider('http://host.url', 0, BasicAuthUsername, BasicAuthPassword));
There you go, now you can use it:
var coinbase = webze.zrm.coinbase;
var balance = webze.zrm.getBalance(coinbase);
You can find more examples in example
directory.
- Node.js
- npm
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install nodejs-legacy
npm run-script build
npm test