pec-web3
Version:
Perpetual JavaScript API
81 lines (63 loc) • 2.2 kB
JavaScript
/*
This file is part of web3.js.
web3.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
web3.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file index.js
* @authors:
* Fabian Vogelsteller <fabian@ethereum.org>
* Gav Wood <gav@parity.io>
* Jeffrey Wilcke <jeffrey.wilcke@ethereum.org>
* Marek Kotewicz <marek@parity.io>
* Marian Oancea <marian@ethereum.org>
* @date 2017
*/
;
var version = require('../package.json').version;
var core = require('pec-core');
var Eth = require('pec-eth');
var Net = require('pec-net');
var Personal = require('pec-eth-personal');
var Shh = require('pec-shh');
var Bzz = require('pec-bzz');
var utils = require('pec-utils');
var Web3 = function Web3() {
var _this = this;
// sets _requestmanager etc
core.packageInit(this, arguments);
this.version = version;
this.utils = utils;
this.eth = new Eth(this);
this.shh = new Shh(this);
this.bzz = new Bzz(this);
// overwrite package setProvider
var setProvider = this.setProvider;
this.setProvider = function (provider, net) {
/*jshint unused: false */
setProvider.apply(_this, arguments);
_this.eth.setRequestManager(_this._requestManager);
_this.shh.setRequestManager(_this._requestManager);
_this.bzz.setProvider(provider);
return true;
};
};
Web3.version = version;
Web3.utils = utils;
Web3.modules = {
Eth: Eth,
Net: Net,
Personal: Personal,
Shh: Shh,
Bzz: Bzz
};
core.addProviders(Web3);
module.exports = Web3;