Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Eth = function Eth() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
// overwrite setProvider
var setProvider = this.setProvider;
this.setProvider = function () {
setProvider.apply(_this, arguments);
_this.net.setProvider.apply(_this, arguments);
_this.personal.setProvider.apply(_this, arguments);
_this.accounts.setProvider.apply(_this, arguments);
_this.Contract.setProvider(_this.currentProvider, _this.accounts);
};
var defaultAccount = null;
var defaultBlock = 'latest';
Object.defineProperty(this, 'defaultAccount', {
var Personal = function Personal() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
this.net = new Net(this.currentProvider);
var defaultAccount = null;
var defaultBlock = 'latest';
Object.defineProperty(this, 'defaultAccount', {
get: function () {
return defaultAccount;
},
set: function (val) {
if(val) {
defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val));
}
// update defaultBlock
var Eth = function Eth() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
// overwrite setProvider
var setProvider = this.setProvider;
this.setProvider = function () {
setProvider.apply(_this, arguments);
_this.net.setProvider.apply(_this, arguments);
_this.personal.setProvider.apply(_this, arguments);
_this.accounts.setProvider.apply(_this, arguments);
_this.Contract.setProvider(_this.currentProvider, _this.accounts);
};
var defaultAccount = null;
var defaultBlock = 'latest';
Object.defineProperty(this, 'defaultAccount', {
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) {
setProvider.apply(_this, arguments);
this.eth.setProvider(provider, net);
this.shh.setProvider(provider, net);
this.bzz.setProvider(provider);
var Accounts = function Accounts() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
// remove unecessary core functions
delete this.BatchRequest;
delete this.extend;
var _ethereumCall = [
new Method({
name: 'getId',
call: 'net_version',
params: 0,
outputFormatter: utils.hexToNumber
}),
new Method({
name: 'getGasPrice',
call: 'eth_gasPrice',
params: 0
var Eth = function Eth() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
// overwrite setProvider
var setProvider = this.setProvider;
this.setProvider = function () {
setProvider.apply(_this, arguments);
_this.net.setProvider.apply(_this, arguments);
_this.personal.setProvider.apply(_this, arguments);
_this.accounts.setProvider.apply(_this, arguments);
_this.Contract.setProvider(_this.currentProvider, _this.accounts);
};
var defaultAccount = null;
var defaultBlock = 'latest';
Object.defineProperty(this, 'defaultAccount', {
var Shh = function Shh() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
// overwrite setProvider
var setProvider = this.setProvider;
this.setProvider = function () {
setProvider.apply(_this, arguments);
_this.net.setProvider.apply(_this, arguments);
};
this.net = new Net(this.currentProvider);
[
new Subscriptions({
name: 'subscribe',
type: 'shh',
subscriptions: {
'messages': {
var Accounts = function Accounts() {
var _this = this;
// sets _requestmanager
core.packageInit(this, arguments);
// remove unecessary core functions
delete this.BatchRequest;
delete this.extend;
var _ethereumCall = [
new Method({
name: 'getNetworkId',
call: 'net_version',
params: 0,
outputFormatter: parseInt
}),
new Method({
name: 'getChainId',
call: 'eth_chainId',
params: 0,
var Contract = function Contract(jsonInterface, address, options) {
var _this = this,
args = Array.prototype.slice.call(arguments);
if(!(this instanceof Contract)) {
throw new Error('Please use the "new" keyword to instantiate a web3.eth.contract() object!');
}
// sets _requestmanager
core.packageInit(this, [this.constructor.currentProvider]);
this.clearSubscriptions = this._requestManager.clearSubscriptions;
if(!jsonInterface || !(Array.isArray(jsonInterface))) {
throw new Error('You must provide the json interface of the contract when instantiating a contract object.');
}
// create the options object
this.options = {};
var lastArg = args[args.length - 1];
if(_.isObject(lastArg) && !_.isArray(lastArg)) {
}
}
}
})
];
methods.forEach(function(method) {
method.attachToObject(_this);
method.setRequestManager(_this._requestManager, _this.accounts); // second param means is eth.accounts (necessary for wallet signing)
method.defaultBlock = _this.defaultBlock;
method.defaultAccount = _this.defaultAccount;
});
};
core.addProviders(Eth);
module.exports = Eth;