Skip to content

insight-chain/inb-web3i.js

Repository files navigation

Migration 0.13.0 -> 0.14.0

web3i.js version 0.14.0 supports multiple instances of web3i object. To migrate to this version, please follow the guide:

-var web3i = require('web3i');
+var web3i = require('web3i');
+var web3i = new web3i();

Ethereum JavaScript API

Join the chat at https://gitter.im/ethereum/web3i.js

This is the Ethereum 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][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Stories in Ready][waffle-image]][waffle-url]

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

Documentation

Installation

Javascript

<script src="./dist/web3i.js"></script>

As Browser module

Bower

bower install web3i

Component

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

Usage

Use the web3i object directly from global namespace:

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

Set a provider (HttpProvider)

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

Set a provider (HttpProvider using HTTP Basic Authentication)

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

There you go, now you can use it:

var coinbase = web3i.inb.coinbase;
var balance = web3i.inb.getBalance(coinbase);

You can find more examples in example directory.

Contribute!

Requirements

  • Node.js
  • npm
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install nodejs-legacy

Building (gulp)

npm run-script build

Testing (mocha)

npm test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published